Closed erwan-joly closed 1 year ago
I too am having this issue. It seems we may not be able to use Linq2Db because of this
Will check what we can do here
The best workaround we think we found was to decorate our EF entities with L2Db attributes. We didn't try it in the end as we're firmly into crunch time on our dev stream. Also we felt that having essentially 2 sets of mappings (EFcore fluent and L2Db attributes). We'll definitely revisit L2DB at a later date though.
@zeocrash. I have prepared fix in main library. If Discriminator field is not shadow property it will work. Probably will release new version this Thursday.
Closing as fix was released long time ago (linq2db 3.4.4): https://github.com/linq2db/linq2db/pull/3204
FYI : I noticed TPH doesn't work well with BulkCopy https://github.com/NosCoreIO/NosCore.Dao/blob/52480cab1ca7bbf3244663441603a4bcbf82b911/src/NosCore.Dao/Dao.cs#L145
the dbcontext https://github.com/NosCoreIO/NosCore.Dao/blob/master/test/NosCore.Dao.Tests/Database/NosCoreContext.cs
when running the tests i'm getting "NOT NULL constraint failed: CompositeTphBaseEntity.Discriminator"
i don't think TPH is widely used anyway but seems to be one of the current limitation of this library