Search code examples
nhibernatefluent-nhibernate

how to ignore a property by attribute in nhibernate


How can i ignore a property by decorating a property with an attribute? the base class AttributePropertyConvention doesn't seems to have that ability, or can it? Doesn't find anything sutiable on IPropertyInstance to set..


Solution

  • it was very easy:

    public class IgnoreAttributeConvention : AttributePropertyConvention<IgnoreAttribute>
    {
        protected override void Apply(IgnoreAttribute attribute, IPropertyInstance instance)
        {
            instance.ReadOnly();
        }
    }
    

    where IgnoreAttribute is a simple/empty attribute.