First time journey with (Fluent) NHibernate. What I am trying to do is to add conventions for the attributes in System.ComponentModel.DataAnnotations.
How would I add a Check Constraint for the attribute.MinimumLength? Here is my code so far:
Thanks!
using System.ComponentModel.DataAnnotations;
using FluentNHibernate.Conventions;
using FluentNHibernate.Conventions.Instances;
public class StringLengthConvention : AttributePropertyConvention<StringLengthAttribute>
{
protected override void Apply( StringLengthAttribute attribute, IPropertyInstance instance )
{
// instance.Check is a read-only property?
// Huh?
instance.Length( attribute.MaximumLength );
}
}
:: EDIT ::
This seems to be a feature that has not been ported yet, see: http://code.google.com/p/fluent-nhibernate/issues/detail?id=358