-
-
Notifications
You must be signed in to change notification settings - Fork 582
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
Autoincluded properties doesnt copied when use BulkRead #848
Comments
BulkReading subEntites is a problem of itself, and one solution is given in the issue you already referenced. |
i mean than when property is autoincluded your
will transformed as query select entity.*, navEntity.* from (your rawSql query) as entity join navigationEntity navEntity on entity.id = navEntity.entityId and when your call
every item of IList<T> existingEntities contains data in navigation property but it will be lost, that data dont copied to IList<T> entities .you dont need to have implementation to read subEntites, it already implemented by efcore and subentities included when navProperty is autoincluded but maybe i misunderstanding something can write a test showing this behaviour |
This can now be done using config ReplaceReadEntities:
|
since EF Core 6.0. you can setup you property like that
builder.Entity<Entity>.Navigation(i => i.Items).AutoInclude();
and usage
context.BulkReadAsync(entities)
transforms into query with additional join on Items table and return entities with filled Items navigation propertybut
EFCore.BulkExtensions/EFCore.BulkExtensions/TableInfo.cs
Line 800 in 8622039
i think copy not empty navigation properties will be good decision instead of doing smth like this #733 (comment)
The text was updated successfully, but these errors were encountered: