var objectExternalIds = new string[] { "abc" };
var query = from order in Context.Order
join apointment in Context.Appointment on order.Nr equals apointment.OrderNr
where objectExternalIds.Contains(order.ObjectId)
select apointment.Id;
var result = await query.ToListAsync(cancellationToken);
An exception was thrown while attempting to evaluate the LINQ query parameter expression 'op_Implicit(Convert(value(Application.Shared.DataWrappers.Order.OrderDataWrapper+c__DisplayClass23_0).objectExternalIds, String[]))'. See the inner exception for more information.
GenericArguments[1], 'System.ReadOnlySpan`1[System.String]', on 'System.Linq.Expressions.Interpreter.FuncCallInstruction`2[T0,TRet]' violates the constraint of type 'TRet'.
GenericArguments[1], 'System.ReadOnlySpan`1[System.String]', on 'System.Linq.Expressions.Interpreter.FuncCallInstruction`2[T0,TRet]' violates the constraint of type parameter 'TRet'.
Ich verwende eine MySql-Datenbank mit Pomelo.EntityFrameworkCore.MySql als Anbieter
Ich bekomme diesen Fehler nicht, sollte ziemlich eng sein
BEARBEITEN:
Kontextklassen:
public class Order {
public int Id { get; set; }
public string ObjectId { get; set; }
...
}
public class Appointment {
public int Id { get; set; }
public int? OrderNr { get; set; }
...
}
System.InvalidOperationException
HResult=0x80131509
Message=An exception was thrown while attempting to evaluate the LINQ query parameter expression 'op_Implicit(Convert(value(Application.Shared.DataWrappers.Order.OrderDataWrapper+c__DisplayClass23_0).objectExternalIds, String[]))'. See the inner exception for more information.
Source=Microsoft.EntityFrameworkCore
StackTrace:
at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.GetValue(Expression expression, String& parameterName)
at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Evaluate(Expression expression, Boolean generateParameter)
at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Visit(Expression expression)
at System.Dynamic.Utils.ExpressionVisitorUtils.VisitArguments(ExpressionVisitor visitor, IArgumentProvider nodes)
at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node)
at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Visit(Expression expression)
at System.Linq.Expressions.ExpressionVisitor.VisitLambda[T](Expression`1 node)
at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Visit(Expression expression)
at System.Linq.Expressions.ExpressionVisitor.VisitUnary(UnaryExpression node)
at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Visit(Expression expression)
at System.Dynamic.Utils.ExpressionVisitorUtils.VisitArguments(ExpressionVisitor visitor, IArgumentProvider nodes)
at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node)
at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Visit(Expression expression)
at System.Dynamic.Utils.ExpressionVisitorUtils.VisitArguments(ExpressionVisitor visitor, IArgumentProvider nodes)
at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node)
at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Visit(Expression expression)
at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.ExtractParameters(Expression expression, Boolean clearEvaluatedValues)
at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.ExtractParameters(Expression expression)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExtractParameters(Expression query, IParameterValues parameterValues, IDiagnosticsLogger`1 logger, Boolean parameterize, Boolean generateContextAccessors)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteAsync[TResult](Expression query, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.ExecuteAsync[TResult](Expression expression, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1.GetAsyncEnumerator(CancellationToken cancellationToken)
at System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable`1.GetAsyncEnumerator()
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.d__67`1.MoveNext()
at Program.d__9.MoveNext() in C:\_temp\Test\Program.cs:line 59
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
ArgumentException: GenericArguments[1], 'System.ReadOnlySpan`1[System.String]', on 'System.Linq.Expressions.Interpreter.FuncCallInstruction`2[T0,TRet]' violates the constraint of type 'TRet'.
Inner Exception 2:
TypeLoadException: GenericArguments[1], 'System.ReadOnlySpan`1[System.String]', on 'System.Linq.Expressions.Interpreter.FuncCallInstruction`2[T0,TRet]' violates the constraint of type parameter 'TRet'.
Haben Sie eine ziemlich einfache LINQ-Abfrage: [code]var objectExternalIds = new string[] { "abc" }; var query = from order in Context.Order join apointment in Context.Appointment on order.Nr equals apointment.OrderNr where objectExternalIds.Contains(order.ObjectId) select apointment.Id;
var result = await query.ToListAsync(cancellationToken); [/code] Dies erzeugt den Fehler: [code]An exception was thrown while attempting to evaluate the LINQ query parameter expression 'op_Implicit(Convert(value(Application.Shared.DataWrappers.Order.OrderDataWrapper+c__DisplayClass23_0).objectExternalIds, String[]))'. See the inner exception for more information. GenericArguments[1], 'System.ReadOnlySpan`1[System.String]', on 'System.Linq.Expressions.Interpreter.FuncCallInstruction`2[T0,TRet]' violates the constraint of type 'TRet'. GenericArguments[1], 'System.ReadOnlySpan`1[System.String]', on 'System.Linq.Expressions.Interpreter.FuncCallInstruction`2[T0,TRet]' violates the constraint of type parameter 'TRet'. [/code] Ich verwende eine MySql-Datenbank mit Pomelo.EntityFrameworkCore.MySql als Anbieter Ich bekomme diesen Fehler nicht, sollte ziemlich eng sein BEARBEITEN: Kontextklassen: [code]public class Order { public int Id { get; set; } public string ObjectId { get; set; } ... }
public class Appointment { public int Id { get; set; } public int? OrderNr { get; set; } ... } [/code] DB-Schema: [code]CREATE TABLE `Order` ( `Nr` int(10) NOT NULL DEFAULT '0', `ObjectId` varchar(50) COLLATE utf8_german2_ci DEFAULT NULL, PRIMARY KEY (`Nr`), ... ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_german2_ci;
CREATE TABLE `Appointment` ( `ID` int(10) NOT NULL AUTO_INCREMENT, `OrderNr` int(10) DEFAULT '0', PRIMARY KEY (`ID`), ... ) ENGINE=InnoDB AUTO_INCREMENT=20848625 DEFAULT CHARSET=utf8 COLLATE=utf8_german2_ci; [/code] Vollständige Ausnahme: [code]System.InvalidOperationException HResult=0x80131509 Message=An exception was thrown while attempting to evaluate the LINQ query parameter expression 'op_Implicit(Convert(value(Application.Shared.DataWrappers.Order.OrderDataWrapper+c__DisplayClass23_0).objectExternalIds, String[]))'. See the inner exception for more information. Source=Microsoft.EntityFrameworkCore StackTrace: at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.GetValue(Expression expression, String& parameterName) at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Evaluate(Expression expression, Boolean generateParameter) at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Visit(Expression expression) at System.Dynamic.Utils.ExpressionVisitorUtils.VisitArguments(ExpressionVisitor visitor, IArgumentProvider nodes) at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node) at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Visit(Expression expression) at System.Linq.Expressions.ExpressionVisitor.VisitLambda[T](Expression`1 node) at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Visit(Expression expression) at System.Linq.Expressions.ExpressionVisitor.VisitUnary(UnaryExpression node) at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Visit(Expression expression) at System.Dynamic.Utils.ExpressionVisitorUtils.VisitArguments(ExpressionVisitor visitor, IArgumentProvider nodes) at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node) at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Visit(Expression expression) at System.Dynamic.Utils.ExpressionVisitorUtils.VisitArguments(ExpressionVisitor visitor, IArgumentProvider nodes) at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node) at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.Visit(Expression expression) at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.ExtractParameters(Expression expression, Boolean clearEvaluatedValues) at Microsoft.EntityFrameworkCore.Query.Internal.ParameterExtractingExpressionVisitor.ExtractParameters(Expression expression) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExtractParameters(Expression query, IParameterValues parameterValues, IDiagnosticsLogger`1 logger, Boolean parameterize, Boolean generateContextAccessors) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteAsync[TResult](Expression query, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.ExecuteAsync[TResult](Expression expression, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1.GetAsyncEnumerator(CancellationToken cancellationToken) at System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable`1.GetAsyncEnumerator() at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.d__67`1.MoveNext() at Program.d__9.MoveNext() in C:\_temp\Test\Program.cs:line 59
This exception was originally thrown at this call stack: [External Code]
Inner Exception 1: ArgumentException: GenericArguments[1], 'System.ReadOnlySpan`1[System.String]', on 'System.Linq.Expressions.Interpreter.FuncCallInstruction`2[T0,TRet]' violates the constraint of type 'TRet'.
Inner Exception 2: TypeLoadException: GenericArguments[1], 'System.ReadOnlySpan`1[System.String]', on 'System.Linq.Expressions.Interpreter.FuncCallInstruction`2[T0,TRet]' violates the constraint of type parameter 'TRet'. [/code]
Ausgabe
Wir haben einen benutzerdefinierten Serializer für einen Enum (messvaluetype), der die Enum als String in MongoDB speichert und es von einem String zurück in den Umfeld des Abfragers. Wenn...
Unten ist die Abfrage:
SELECT tt.trans_type_name as TRANSACTION_TYPE, trans.TRANSACTION_TIME, a.trans_action_name as TRANSACTION_ACTION_NAME, trans.TRANSACTION_NOTES
FROM
(SELECT CAST(added_on AS...
Hier ist eine Funktion, die von unserer WinUI 3-Anwendung zum Testen der Internetkonnektivität verwendet wird.
In einigen Teilen der Welt gibt diese Funktion immer „false“ zurück. Wir müssen in...
Ich versuche, über einen Docker-Container, in dem ich eine .net-App ausführe, auf PostgreSQL auf dem Server zuzugreifen.
Meine Docker-Datei enthält die folgenden Umgebungsvariablen:
ENV...