Batch Update with Navigation Property does not work
Using a navigation property does not appear to work:
var foos = context.Foos.Where(f => f.DeletedAt == null);
foos.Update(f => new Foo { Sum = f.Bars.Sum(b => b.Value) });
Produces:
System.Data.SqlClient.SqlException : Incorrect syntax near 'Id'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite, String methodName)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Z.EntityFramework.Plus.BatchUpdate.Execute[T](IQueryable`1 query, Expression`1 updateFactory)
...
Using EF Core 2.1, MSSQL.
Hello @psyren89 ,
Thank you for reporting, we successfully reproduced the issue.
We will look at if that's possible to fix it for EF Core.
Best Regards,
Jonathan
Performance Libraries
context.BulkInsert(list, options => options.BatchSize = 1000);
Entity Framework Extensions • Entity Framework Classic • Bulk Operations • Dapper Plus • LinqToSql Plus
Runtime Evaluation
Eval.Execute("x + y", new {x = 1, y = 2}); // return 3
C# Eval Function • SQL Eval Function
I also have this issue. What's the status?
Hello @megumus ,
I don't think anything will be done until we completely re-write this feature.
If I remember well, that issue was caused by how EF Core generate the query. Since we don't control how the query is generated, that make it very hard on our side to support all this kind of special scenario.