Fluent nhibernate 如何在fluent nhibernate中创建IgnoreProperty约定? public类MyObjectMap:IAutoMappingOverride { 公共无效替代(自动映射) { mapping.IgnoreProperty(x=>x.InterfaceProperty); } }

Fluent nhibernate 如何在fluent nhibernate中创建IgnoreProperty约定? public类MyObjectMap:IAutoMappingOverride { 公共无效替代(自动映射) { mapping.IgnoreProperty(x=>x.InterfaceProperty); } },fluent-nhibernate,conventions,Fluent Nhibernate,Conventions,我现在在每个地图上都这样做。。。我怎样才能把它变成一个惯例?我正在添加这样的约定: public class MyObjectMap : IAutoMappingOverride<MyObject> { public void Override(AutoMapping<MyObject> mapping) { mapping.IgnoreProperty(x => x.InterfaceProperty); } } priv

我现在在每个地图上都这样做。。。我怎样才能把它变成一个惯例?我正在添加这样的约定:

public class MyObjectMap : IAutoMappingOverride<MyObject>
{
    public void Override(AutoMapping<MyObject> mapping)
    {
        mapping.IgnoreProperty(x => x.InterfaceProperty);
    }
}
private Action GetConventions()
{
返回c=>
{
c、 添加();
c、 添加();
c、 添加();
c、 添加();
c、 添加();
c、 添加();
c、 添加();
};
}

我认为这与约定无关,但它受到映射覆盖的影响,请尝试以下操作:

    private Action<IConventionFinder> GetConventions()
    {
        return c =>
        {
            c.Add<ForeignKeyConvention>();
            c.Add<HasManyConvention>();
            c.Add<HasManyToManyConvention>();
            c.Add<ManyToManyTableNameConvention>();
            c.Add<PrimaryKeyConvention>();
            c.Add<ReferenceConvention>();
            c.Add<TableNameConvention>();
        };
    }

实际上我还没有尝试过这个,但我认为它可能会有所帮助,并且注意到DefaultAutomappingConfiguration是在Fluent NHibernate V1.1中的我认为这与约定无关,但是它会被映射覆盖,请尝试以下操作:

    private Action<IConventionFinder> GetConventions()
    {
        return c =>
        {
            c.Add<ForeignKeyConvention>();
            c.Add<HasManyConvention>();
            c.Add<HasManyToManyConvention>();
            c.Add<ManyToManyTableNameConvention>();
            c.Add<PrimaryKeyConvention>();
            c.Add<ReferenceConvention>();
            c.Add<TableNameConvention>();
        };
    }
实际上我还没有尝试过这个,但我认为它可能会有所帮助,并且注意到DefaultAutomappingConfiguration在Fluent NHibernate V1.1中