You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched on the issues and did not find something similar and I asked on StackOverflow first and I was told this featured does not exist, so I'm asking here next if this feature exists and if this does not exist I would politely ask for this to be added to the backlog as a feature request.
I have a scenario where I do something similar to this:
var customer1 = await efContext.Customers.SingleAsync(...)
customer1.reference = "ABCD";
var customer2 = await efContext.Customers.SingleAsync(...)
customer2.reference = "XYWZ";
efContext.SaveChanges();
The database has a trigger that overrides references based on some criteria/rule, so customer1 might stay with ABCD in the reference field, but customer2's reference might be overridden to HELLO-XYWZ via the database trigger.
When that happens, my entity in memory is wrong after SaveChanges unless I manually call Reload
Is there a way to tell the EF context that the reference field is generated on the client side but at the same time can be re-generated by the database, and if that happens, refresh the entity in memory automatically during the SaveChanges?
In other words I'm looking for something similar to ValueGeneratedOnAddOrUpdate but saving the value coming the client side first.
The text was updated successfully, but these errors were encountered:
Putting this on the backlog to consider supporting store-generated values that are both written to the database and then also read back from the database in the same command,
ajcvickers
changed the title
Value generated on the client side, that can be changed by the database on add or update
Support store-generated values that are both written to and also read back from the database in the same command
Nov 7, 2020
I searched on the issues and did not find something similar and I asked on StackOverflow first and I was told this featured does not exist, so I'm asking here next if this feature exists and if this does not exist I would politely ask for this to be added to the backlog as a feature request.
I have a scenario where I do something similar to this:
The database has a trigger that overrides references based on some criteria/rule, so
customer1
might stay withABCD
in the reference field, butcustomer2
's reference might be overridden toHELLO-XYWZ
via the database trigger.When that happens, my entity in memory is wrong after
SaveChanges
unless I manually callReload
Is there a way to tell the EF context that the
reference
field is generated on the client side but at the same time can be re-generated by the database, and if that happens, refresh the entity in memory automatically during theSaveChanges
?In other words I'm looking for something similar to
ValueGeneratedOnAddOrUpdate
but saving the value coming the client side first.The text was updated successfully, but these errors were encountered: