You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now, I have a question related to the JSON Array Column. How can I get the array size? (I don't want to use "ToListAsync" or "ToEnumerableAsync" something like these.
System.InvalidOperationException: The LINQ expression 'DbSet<Author>().Where(a =>EF.Property<IList<Address>>(a,"Addresses").AsQueryable().Count()==2)' couldnot be translated. Either rewrite the query in a form that can be translated,orswitch to client evaluation explicitly by inserting a call to 'AsEnumerable','AsAsyncEnumerable','ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.<VisitMethodCall>g__CheckTranslated|15_0(ShapedQueryExpressiontranslated,<>c__DisplayClass15_0&)
at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpressionmethodCallExpression)
at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpressionmethodCallExpression)
at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpressionmethodCallExpression)
at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpressionmethodCallExpression)
at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutor[TResult](Expressionquery)
at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](Expressionquery,Booleanasync)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](IDatabasedatabase,Expressionquery,IModelmodel,Booleanasync)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass9_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](ObjectcacheKey, Func`1compiler)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expressionquery)
at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expressionexpression)
at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1.GetEnumerator()
at JsonColumn.Controllers.AuthorsController.Get()in D:\github\xuzhg\mydotnetconf\JsonColumn\JsonColumn\Controllers\AuthorsController.cs:line 23
at lambda_method3(Closure,Object,Object[])at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(ActionContextactionContext,IActionResultTypeMappermapper,ObjectMethodExecutorexecutor,Objectcontroller,Object[]arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvokerinvoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvokerinvoker,TasklastTask,Statenext,Scopescope,Objectstate,BooleanisCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealedcontext)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State&next,Scope&scope,Object&state,Boolean&isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
The text was updated successfully, but these errors were encountered:
currently querying capabilities are not supported - you can only project the JSON object or it's part. All querying must be done on the client. We track enabling this scenario here: #28616
Include your code
I follow up JSON column from post https://devblogs.microsoft.com/dotnet/announcing-ef7-release-candidate-2/ .
And working a sample at: https://github.com/xuzhg/mydotnetconf/tree/JsonColumn/JsonColumn
Now, I have a question related to the JSON Array Column. How can I get the array size? (I don't want to use "ToListAsync" or "ToEnumerableAsync" something like these.
For example:
Where: 'Addresses' is saved as a JSON array column on the DB side, (I call ToJson in the DbContext)
So, when I do like:
Of course, I can do as follows (it works), but that's not what I want.
Did I do anything wrong? Thanks.
I am using EFCore.SqlServer 7.0.2
The text was updated successfully, but these errors were encountered: