问题
I have an entity with a string property mapped to a nvarchar field in the DB. I use an after insert/update trigger to set the value of this field. By default EF will not load the value of this field after insert/update - only identity fields are reloaded from DB after insert.
I've tried to change the StoreGeneratedPattern option on this field to Computed (which seems like the right way to do that) but I get the error:
The store generated pattern 'Computed' is not supported for properties that are not of type 'timestamp' or 'rowversion'.
Does it mean that EF supports reloading only timestamps? How can I force EF to load the values of columns of other types?
回答1:
I think it is a bug. I just reproduced this behavior and posted a question to MSDN forum. This works without any problem when using EDMX and model first.
来源:https://stackoverflow.com/questions/5445243/reload-field-value-modified-in-db-by-trigger-after-insert-update