EFCore.BulkExtensions
EFCore.BulkExtensions copied to clipboard
NullReferenceException on BulkInsert with Owned Entity Type on a backing field
Hi,
I'm having trouble to bulk insert some entity with an owned type. The owned type is a private backing field (_fieldA) (and used by some other public setters)
I get a NullReferenceException on this line: https://github.com/borisdj/EFCore.BulkExtensions/blob/304f48643a294dd274ef256389ec800452e0e521/EFCore.BulkExtensions/TableInfo.cs#L548
I can see that navigationProperty.PropertyInfo is null, but navigationProperty.FieldInfo is not null.
You can find a working repro here: https://github.com/IT-CASADO/EfCoreBulkExtensionsBugs
You can execute the unit tests in the test project.
I'm currently using .NET 6, but I also get this on .NET 8.
Not sure how to get PropertyInfo from private field. If you can maybe try try to change your entity to standard model with public Property.