Closed bt-88 closed 7 months ago
Anyone? If someone can guide me in the right direction I'm willing to draft a PR for this.
Sorry for delay, it needs API design, not simple thing right now. I can help you to write such method without changing linq2db
code.
Sorry for delay, it needs API design, not simple thing right now. I can help you to write such method without changing
linq2db
code.
Thank you, that would be awesome. Please show me how when you have the time.
I assume it should work only if TSource
and TTarget
are the same?
I assume it should work only if
TSource
andTTarget
are the same?
Yes, correct.
Added answer in linq2db repository.
As is
Currently, for merge operations, you provide two overloads:
UpdateWhenMatched()
: Updates all fields that are in both source and targetUpdateWhenMatched(Expression<Func<TTarget,TSource,TTarget>> setter)
: Updates the fields as specified in the user defined setterTo be
What I would like to have is a combination of both. That is, it updates all fields that are in both source and target AND applies the custom 'overrides' for some of the fields.
Use case
Use case. Have user defined setters for the
UpdatedAt
andCreatedAt
fields in my base entity, but use the default update setters for all other fields.The same applies to
.InsertWhenNotMatched
. Here I would like to do: