EFCore.BulkExtensions icon indicating copy to clipboard operation
EFCore.BulkExtensions copied to clipboard

feat: specify custom primary key for BulkInsert(OrUpdate)(OrDelete)(Async)

Open tsanton opened this issue 1 year ago • 1 comments

Have you considered enabling users to specify a custom key for "merges"?

My use case is that I have a table that tracks statuses for a given entity, and the primary key takes the natural form of "EntityId", "id" to avoid key collision on multiple inserts. I now want to insert statuses where the ["EntityId", "Status"] combination does not exists from before (no issue with conflicts because it's a one way street). This could be achieved with a custom key of ["EntityId", "Status"], PropertiesToIncludeOnUpdate = [].

My target database is PG.

tsanton avatar Apr 25 '24 17:04 tsanton

Did you checked UpdateByProperties info from ReadMe, that should do it.

borisdj avatar Apr 25 '24 22:04 borisdj