简体   繁体   中英

entity framework code first soft delete

I have Entities with field DeletedAt. Those entities implement ISoftDelete. What i want is to automatically ignore all rows that have value on DeletedAt. Is it possible?

one thought was discriminator, but this is more for inheritance.

it would be really nice if there were that feature in DbModelBuilder like

modelBuilder.Entity<ISoftDelete>().Where(x => x.DeletedAt == null)

Create Another Extender and inside it put

modelBuilder.Entity<ISoftDelete>().Where(x => x.DeletedAt == null)

and it should return data as queryable.

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