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
I couldn't find an existing for this, let me know if there is one.
I was surprised to find out that ExecuteUpdate doesn't seem to work at all on the new JSON columns. It doesn't work on individual properties on the JSON document, nor does it work on the entire column (which should've been straightforward to implement), nor does it work on JSON collections. Is this expected?!
Unhandled exception. System.InvalidOperationException: The LINQ expression 'DbSet<Product>()
.Select(p => IncludeExpression(
EntityExpression:
IncludeExpression(
EntityExpression:
p,
NavigationExpression:
EF.Property<Trait>(p, "MainTrait"), MainTrait)
,
NavigationExpression:
MaterializeCollectionNavigation(
Navigation: Product.Traits,
subquery: EF.Property<List<Trait>>(p, "Traits")
.AsQueryable()), Traits)
)
.ExecuteUpdate(b => b.SetProperty<Trait>(
propertyExpression: p => p.MainTrait,
valueExpression: __get_Item_0))' could not be translated. Additional information: The following lambda argument to 'SetProperty' does not represent a valid property to be set: 'p => p.MainTrait'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.Translate(Expression expression)
at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.Translate(Expression expression)
at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutor[TResult](Expression query)
at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](Expression query, Boolean async)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass9_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression)
at Microsoft.EntityFrameworkCore.RelationalQueryableExtensions.ExecuteUpdate[TSource](IQueryable`1 source, Expression`1 setPropertyCalls)
at Program.<Main>$(String[] args) in /home/arad/scratchpad/efcore-json-test/Program.cs:line 41
The text was updated successfully, but these errors were encountered:
The workaround for #32058 mentioned in this comment doesn't actually work for JSON columns, because of #28766, but then even if #28766 was implemented, that alone would still not solve the problem because it wouldn't work for collections (e.g. the Product.Traits in the example above).
So, am I right in thinking that this means #32058 isn't just a nice-to-have, but pretty crucial?
Currently, there seems to be no actual workaround for this, ExecuteUpdate simply doesn't work on JSON columns. Right?
Does that mean we have to resort to traditional change-tracking-style updates for JSON columns for now?
I couldn't find an existing for this, let me know if there is one.
I was surprised to find out that
ExecuteUpdate
doesn't seem to work at all on the new JSON columns. It doesn't work on individual properties on the JSON document, nor does it work on the entire column (which should've been straightforward to implement), nor does it work on JSON collections. Is this expected?!Repro:
Program.cs
:The
.csproj
file:The exception details:
The text was updated successfully, but these errors were encountered: