-
Notifications
You must be signed in to change notification settings - Fork 104
Open
Description
I don't find a way to use Flexlabs.Upsert in my case.
I have two unique indexes:
( CompanyId, InternalCode )
( CompanyId, Cip13)
The following command would suit my case, but two On(..) are not supported
await _context.Set<ProductInfoForCompany>()
.UpsertRange(companyProducts)
.On(cp => new { cp.InternalCode, cp.CompanyId })
.On(cp => new { cp.Cip13, cp.CompanyId })
.WhenMatched(cp => new ProductInfoForCompany
{
InternalCode = cp.InternalCode,
CompanyId = cp.CompanyId,
Cip13 = cp.Cip13,
UpdatedAt = DateTime.UtcNow,
})
.WithFallbackExpressionCompiler()
.RunAsync(ct);
With a single On ( .On(cp => new { cp.Cip13, cp.CompanyId }) is missing),
- if InternalCode has changed, (Cip13, CompanyId ) is not matched. It will then try to insert, and create a duplicate key for (Cip13, CompanyId ).
- if Cip13 has changed, (InternalCode, CompanyId ) is not matched. It will then try to insert, and create a duplicate key for (InternalCode, CompanyId ).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels