Rei

That's exactly the sort of logic I was looking for (maybe without the
magic "string" though). But, no, it doesn't work properly. Should it?

Thx!
Berryl

On Apr 16, 9:22 am, Rei <rarol...@gmail.com> wrote:
> Can you check if the "length" attribute has been set with the
> HasAttribute method of the IProperty in the Accept method and only
> return true if it has not been set?
>
> Something like
>
> public bool Accept(IProperty property) {
>     return property.HasAttribute("length");
>
> }
>
> On Apr 16, 5:21 pm, Berryl Hesh <ef747...@gmail.com> wrote:
>
> > Please forgive me if the answer to this should be obvious from the
> > docs.
>
> > I'm using AutoMapping w/ conventions, and I have an override class.
> > The case I'm asking about happens to be re: StringLength but I'm
> > hoping the idea should be applicable to any convention.
>
> > Convention class
> > ------------------------
> > public class DefaultStringLengthConvention: IPropertyConvention
> >     {
> >         public bool Accept(IProperty property) { return true; }
>
> >         public void Apply(IProperty property) { property.WithLengthOf
> > (50); }
> >     }
>
> > Override
> > -----------------
> >         public void Override(AutoMap<User> mapping) {
> >             mapping.Map(x => x.Email).WithLengthOf(30);
> >         }
>
> > FNH looks at the override class before the convention, which explains
> > why the generated ddl for Email.StringLength winds up being 50 instead
> > of 30; so I'm guessing I need some logic in Accept() to deal with
> > this.
>
> > Is that the case?
>
> > Thx!
> > Berryl
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to