PawelGerr / Thinktecture.EntityFrameworkCore

These libraries extend Entity Framework Core by a few features to make it easier to work with EF and for easier integration testing or to get more performance in some special cases.
https://dev.azure.com/pawelgerr/Thinktecture.EntityFrameworkCore
BSD 3-Clause "New" or "Revised" License
66 stars 17 forks source link

EF Core Relationships #50

Closed Math-rm1 closed 10 months ago

Math-rm1 commented 10 months ago

Hey,

I'm currently using this library for bulk operations in my .NET 8.0 project. The bulk upsert method works well for parent entities, but it doesn't seem to handle cascading updates on related entities. Is there support for this feature, or any advice on achieving it with the current version?

Thanks!

PawelGerr commented 10 months ago

Are you talking about owned entities? If not then you have to make bulk-update twice, one call for parents and one call for children.

List<Parent> parents = ...;
List<Child> children = parents.Select(p => p.Child).ToList();

await ctx.BulkUpdateAsync(parents);
await ctx.BulkUpdateAsync(children);