Fluent NHibernate 如何重写抽象基类的映射
我想对我的所有 Types Of AuditedEntity
执行此操作,但正如我们告诉 FH 忽略基本摘要一样,代码不会受到影响。我不想对我的所有实体执行此操作,然后让某人在添加新的 typeof
public abstract class AuditedEntity : Entity ...
public class AuditedEntityMappings : IAutoMappingOverride<AuditedEntity>
{
public void Override(AutoMapping<AuditedEntity> mapping)
{
mapping.Where("DeletedById is null");
}
}
这篇文章看起来很有希望,但该方法已被弃用
I want to do this for all my Types Of AuditedEntity
, but as we've told FH to ignore base abstracts, the code isnt getting hit. i dont want to do this for all my entities and then have someone forget when they add a new typeof<AuditedEntity>
public abstract class AuditedEntity : Entity ...
public class AuditedEntityMappings : IAutoMappingOverride<AuditedEntity>
{
public void Override(AutoMapping<AuditedEntity> mapping)
{
mapping.Where("DeletedById is null");
}
}
This post looked promising but that method is deprecated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
感谢对一些相当复杂的表达式的一些帮助,导致了以下扩展:
Got it working thanks to some help on some reasonably complex expressions leading to the following extensions: