EntityFramework-Extensions
EntityFramework-Extensions copied to clipboard
UpdateFromQuery fails using related entity (EF Core)
Description
UpdateFromQuery
fails when using related entity in EF Core.
Note that it works in EF.
Exception
Microsoft.Data.SqlClient.SqlException (0x80131904): The multi-part identifier "r.PropInRelated" could not be bound.
The multi-part identifier "r.PropInRelated" could not be bound.
at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) in /_/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs:line 1853
at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) in /_/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlInternalConnection.cs:line 611
at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) in /_/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs:line 1327
at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) in /_/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs:line 2550
at Microsoft.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean isAsync, Int32 timeout, Boolean asyncWrite) in /_/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs:line 3233
at Microsoft.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String methodName) in /_/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs:line 1546
at Microsoft.Data.SqlClient.SqlCommand.ExecuteNonQuery() in /_/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs:line 1090
at Z.EntityFramework.Extensions.BatchUpdate.<>c.(DbCommand , Nullable`1 )
at Z.EntityFramework.Extensions.BatchUpdate.Execute[T](IQueryable`1 query, Expression`1 updateFactory)
at BatchUpdateExtensions.UpdateFromQuery[T](IQueryable`1 query, Expression`1 updateFactory)
at Program.UpdateForOwnPropertiesUsingRelatedProperties()
at Program.RunTest(Expression`1 test)
ClientConnectionId:8737b8c8-ddf8-4ac2-96c6-7652d06b73b5
Error Number:4104,State:1,Class:16
Fiddle or Project (Optional)
https://dotnetfiddle.net/g4Rq0T
Further technical details
- EF version: EF Core 6.0.4
- EF Extensions version: Z.EntityFramework.Extensions.EFCore 6.13.17
- Database Provider: SQL Server
Hello @davidnemeti ,
The answer for this one will be similar to the one provided on: https://github.com/zzzprojects/EntityFramework-Extensions/issues/484
Unfortunately, that's currently unsupported.
However, we are currently working hard to recode some parts of our library to be able to handle more complex scenarios like this one. I cannot provide any expected date but I believe it will come during this summer.
Best Regards,
Jon