实体框架代码优先软删除
我有带有字段DeletedAt 的实体。这些实体实现 ISoftDelete。 我想要的是自动忽略在DeletedAt 上具有值的所有行。是否可以?
一种想法是判别器,但这更多的是为了继承。
如果 DbModelBuilder 中有这个功能就好了
modelBuilder.Entity<ISoftDelete>().Where(x => x.DeletedAt == null)
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建另一个扩展器并将其放入其中
,它应该返回可查询的数据。
Create Another Extender and inside it put
and it should return data as queryable.