We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redis.OM version 0.6.1
xxxCollection.Where(h => h.D == date && h.P.Any(pp => bcs.Contains(pp.B))).Take(10).ToListAsync();
throw exception:
消息: System.InvalidCastException : Unable to cast object of type 'System.Linq.Expressions.MethodCallExpression2' to type 'System.Linq.Expressions.BinaryExpression'. 堆栈跟踪: ExpressionParserUtilities.TranslateAnyForEmbeddedObjects(MethodCallExpression exp, List`1 parameters) ExpressionParserUtilities.TranslateMethodStandardQuerySyntax(MethodCallExpression exp, List`1 parameters) ExpressionParserUtilities.GetOperandStringForQueryArgs(Expression exp, List`1 parameters, Boolean treatEnumsAsInt, Boolean negate) ExpressionTranslator.TranslateBinaryExpression(BinaryExpression binExpression, List`1 parameters) ExpressionTranslator.BuildQueryFromExpression(Expression exp, List`1 parameters) ExpressionTranslator.TranslateWhereMethod(MethodCallExpression expression, List`1 parameters) ExpressionTranslator.BuildQueryFromExpression(Expression expression, Type type, Expression mainBooleanExpression, Type rootType) RedisCollectionEnumerator`1.ctor(Expression exp, IRedisConnection connection, Int32 chunkSize, RedisCollectionStateManager stateManager, Expression`1 booleanExpression, Boolean saveState, Type rootType, Type type) RedisCollection`1.GetAsyncEnumerator(CancellationToken cancellationToken) RedisCollection`1.ToListAsync() RedisIndexTest.SearchTest() 行 147 --- End of stack trace from previous location ---
if update this method ExpressionParserUtilities.TranslateAnyForEmbeddedObjects like the following can resolve this problem:
ExpressionParserUtilities.TranslateAnyForEmbeddedObjects
private static string TranslateAnyForEmbeddedObjects(MethodCallExpression exp, List<object> parameters) { var type = exp.Arguments.Last().Type; var prefix = GetOperandString(exp.Arguments[0]); var lambda = (LambdaExpression)exp.Arguments.Last(); if (lambda.Body is MethodCallExpression methodCall) { var tempQuery = TranslateMethodExpressions(methodCall, parameters); return tempQuery.Replace("@", $"{prefix}_"); } else { var tempQuery = ExpressionTranslator.TranslateBinaryExpression((BinaryExpression)lambda.Body, parameters); return tempQuery.Replace("@", $"{prefix}_"); } }
The text was updated successfully, but these errors were encountered:
It seems like the problem persists in Redis.OM 0.7.0, as I also ran into the same issue. Have you thought about opening a PR?
Sorry, something went wrong.
No branches or pull requests
Redis.OM version 0.6.1
throw exception:
if update this method
ExpressionParserUtilities.TranslateAnyForEmbeddedObjects
like the following can resolve this problem:The text was updated successfully, but these errors were encountered: