简体   繁体   中英

Self-tracking entities original values

Self-tracking entities do not save original properties values. So all properties are marked as modified when you call ApplyChanges. But I need to log the properties which actually changed. I tried to use ApplyOriginalValues, but in this case AcceptChanges throws an exception as finds entities duplicates. Are there any ways to make STE keep original values?

The generated self tracking template is tracking changes, but not saving the original values for properties that are not part of the EntityKey, are not foreign keys or their ConcurrencyMode properties not set to Fixed .

I needed to enable this value tracking for one of my properties, so I decided to set its ConcurrencyMode property to Fixed so it tracks the original value now.

The side effect of this change is that the generated UPDATE SQL statement will contain a check for the original value of this property in its WHERE clause.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM