[fluent-nhib] Re: conventions & overrides

2009-04-17 Thread Rei
rnate@googlegroups.com > [mailto:fluent-nhibern...@googlegroups.com] On Behalf Of Berryl Hesh > Sent: 16 April 2009 19:40 > To: Fluent NHibernate > Subject: [fluent-nhib] Re: conventions & overrides > > I hear you. Maintenance is my goal too so even though it seems more > maintainable to m

[fluent-nhib] Re: conventions & overrides

2009-04-17 Thread Martin Hornagold
with when you have clearly defined conventions with descriptive names. -Original Message- From: fluent-nhibernate@googlegroups.com [mailto:fluent-nhibern...@googlegroups.com] On Behalf Of Berryl Hesh Sent: 16 April 2009 19:40 To: Fluent NHibernate Subject: [fluent-nhib] Re: conventions

[fluent-nhib] Re: conventions & overrides

2009-04-17 Thread Martin Hornagold
[mailto:fluent-nhibern...@googlegroups.com] On Behalf Of Berryl Hesh Sent: 17 April 2009 04:55 To: Fluent NHibernate Subject: [fluent-nhib] Re: conventions & overrides Rei That's exactly the sort of logic I was looking for (maybe without the magic "string" though). But, no, it do

[fluent-nhib] Re: conventions & overrides

2009-04-16 Thread Berryl Hesh
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 wrote: > Can you check if the "length" attribute has been set with the > HasAttribute method of the IProperty in t

[fluent-nhib] Re: conventions & overrides

2009-04-16 Thread Rei
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 H

[fluent-nhib] Re: conventions & overrides

2009-04-16 Thread Rei
Would this help: public bool Accept(IProperty property) { return !property.HasAttribute("length"); } So the convention will only be applied if the length attribute was not previously set. /Rei On Apr 16, 6:09 pm, Berryl Hesh wrote: > I think I like it better having one convention for like

[fluent-nhib] Re: conventions & overrides

2009-04-16 Thread Berryl Hesh
s it makes that statement explicitly and > easier to see what is going on. > > -Original Message- > From: fluent-nhibernate@googlegroups.com > [mailto:fluent-nhibern...@googlegroups.com] On Behalf Of Berryl Hesh > Sent: 16 April 2009 17:10 > To: Fluent NHibernate > S

[fluent-nhib] Re: conventions & overrides

2009-04-16 Thread Martin Hornagold
. -Original Message- From: fluent-nhibernate@googlegroups.com [mailto:fluent-nhibern...@googlegroups.com] On Behalf Of Berryl Hesh Sent: 16 April 2009 17:10 To: Fluent NHibernate Subject: [fluent-nhib] Re: conventions & overrides I think I like it better having one convention for

[fluent-nhib] Re: conventions & overrides

2009-04-16 Thread Berryl Hesh
I think I like it better having one convention for like items (ie, string lengths), like this: public void Apply(IProperty property) { if (property.Property.Name == "Email") { property.WithLengthOf(30); return; } property.WithLen

[fluent-nhib] Re: conventions & overrides

2009-04-16 Thread Martin Hornagold
Berryl, The best way I have found is to create a separate property convention for the edge case. In this property convention create a static Accepts method to allow cleaner calling of it from the default convention: public class EmailStringLengthConvention : IPropertyConvention { public

[fluent-nhib] Re: conventions & overrides

2009-04-16 Thread Jon Kruger
You're on the right track. On Thu, Apr 16, 2009 at 11:21 AM, Berryl Hesh 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'