You could check to see if the length has not been set on the property, and
if it's a string type in your Accept() check.

On Fri, Apr 24, 2009 at 4:18 PM, Mark Nijhof <[email protected]> wrote:

>
> Hi,
>
> When I have the following convention.
>
>    public class DefaultStringLengthConvention : IPropertyConvention
>    {
>        public bool Accept(IProperty target)
>        {
>            return target.PropertyType == typeof(string);
>        }
>
>        public void Apply(IProperty target)
>        {
>            target.WithLengthOf(250);
>        }
>    }
>
> How do I override that some properties have a different length
> conventionally? I mean I have properties called Body and those should
> be bigger. Should I do this, or is there a way to set priority of
> execution?
>
> if (target.Name == "Body")
>    target.WithLengthOf(4001);
> else
>    target.WithLengthOf(250);
>
> Along the same question, how do I a single override outside he conventions?
>
> -Mark
>
> On Fri, Apr 24, 2009 at 10:02 AM, Mark Nijhof <[email protected]>
> wrote:
> > Hmmm well I used the default string length from the PersistenceModel
> > inherited class to change the default length from 100 to 250.
> >
> > Will look in the IPropertyConvention , thanks :)
> >
> > -Mark
> >
> > On Fri, Apr 24, 2009 at 9:34 AM, James Gregory <[email protected]>
> wrote:
> >>
> >> You should write an IPropertyConvention to replicate that; however,
> >> DefaultStringLength was never actually used anywhere...
> >>
> >> On Thursday, April 23, 2009, Paul Batum <[email protected]> wrote:
> >>> This would have been deleted during James' conventions overhaul I
> think. James, what's the equivalent now?
> >>>
> >>> On Fri, Apr 24, 2009 at 8:13 AM, Mark Nijhof <[email protected]>
> wrote:
> >>>
> >>> Hi,
> >>>
> >>> It seems only weeks that I had gotten the latests sources and now a
> >>> few things are not working any more :) no problem but what I would
> >>> like is a list that shows the major changes something like:
> >>>
> >>> PersistenceModel
> >>> Conventions.DefaultStringLength >> something I am figuring out now :)
> >>>
> >>> Anyway I am not talking about signature changes or something like
> >>> that, but when a method doesn't exist any more and no other logical
> >>> choice is there then some list would be great. Doesn't have to be time
> >>> stamped or anything, just from this to that.
> >>>
> >>> In the mean time con someone tell me what happened with
> >>> Conventions.DefaultStringLength?
> >>>
> >>> -Mark
> >>>
> >>>
> >>>
> >>>
> >>> >
> >>>
> >>
> >> >>
> >>
> >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to