Skip to content
New issue

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

UpdateFromQuery fails using related entity (EF Core) #485

Open
davidnemeti opened this issue Apr 27, 2022 · 1 comment
Open

UpdateFromQuery fails using related entity (EF Core) #485

davidnemeti opened this issue Apr 27, 2022 · 1 comment
Assignees

Comments

@davidnemeti
Copy link

davidnemeti commented Apr 27, 2022

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
@JonathanMagnan
Copy link
Member

Hello @davidnemeti ,

The answer for this one will be similar to the one provided on: #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

@JonathanMagnan JonathanMagnan self-assigned this Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants