Reload field value modified in DB by trigger after Insert/Update

廉价感情. 提交于 2020-01-01 19:15:58

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!