views:

11

answers:

1

public class MyObjectMap : IAutoMappingOverride { public void Override(AutoMapping mapping) { mapping.IgnoreProperty(x => x.InterfaceProperty); } }

I am currently doing this in every map... how can I make this into a convention? I am adding conventions like so:

    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>();
        };
    }
A: 

I think this is not something related to Convention,however it is subject to Mapping Overriding, try this:

public class AutoMapDefaultConfig : DefaultAutomappingConfiguration
{
    public override bool ShouldMap(FluentNHibernate.Member member)
    {
        if (member.Name == "InterfaceProperty")
            return false;
        return base.ShouldMap(member);

    }
}

i haven't try this actually, but I think it may help,and notice that the DefaultAutomappingConfiguration is in Fluent-NHibernate V1.1

Nour Sabouny
thank you very much. I'll give that a shot tomorrow
djmc