简体   繁体   中英

Force clause on Entity Framework Where

I have to make my app indepotent . In order to make my updates so, I implemented in my entities a timestamp field, because if a given operation happens to be executed twice the "where id=10 and timestamp=0x008787" will match zero results and nothing will be updated in the database.

The thing is: how can i make the EF include the "extra clause"? because so far the underlying query is always "where id=10"

In code-first you can place a [ConcurrencyCheck] attribute on a property to include it in the WHERE clause.

For keys this is implied, as well as for special TimeStamp properties. Not clear where your property fits in.

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