http://code.google.com/p/fluent-nhibernate/issues/detail?id=168

Turns out this was already reported and a similar patch is attached to
the issue.

On Apr 16, 3:55 pm, brendanjerwin <brendanjer...@gmail.com> wrote:
> Yup, this seems to have fixed it:
>
> Index: src/FluentNHibernate/Conventions/Defaults/
> NullableEnumerationPropertyConvention.cs
> ===================================================================
> --- src/FluentNHibernate/Conventions/Defaults/
> NullableEnumerationPropertyConvention.cs        (revision 447)
> +++ src/FluentNHibernate/Conventions/Defaults/
> NullableEnumerationPropertyConvention.cs        (working copy)
> @@ -14,7 +14,7 @@
>          {
>              var type = target.PropertyType;
>
> -            return type.IsGenericType && type.GetGenericTypeDefinition
> ().Equals(typeof(Nullable<>)) && type.GetGenericArguments()[0].IsEnum;
> +            return type.IsGenericType && type.GetGenericTypeDefinition
> ().Equals(typeof(Nullable<>)) && type.GetGenericArguments()[0].IsEnum
> && !target.HasAttribute("type");
>          }
>
>          public void Apply(IProperty target)
>
> On Apr 16, 3:53 pm, brendanjerwin <brendanjer...@gmail.com> wrote:
>
>
>
> > It might be that my property is a nullable enum type:
>
> >    public virtual TransactionState? State
>
> > I notice that the EnumerationPropertyConvention has this:
>
> >         public bool Accept(IProperty target)
> >         {
> >             return target.PropertyType.IsEnum && !target.HasAttribute
> > ("type");
> >         }
>
> > but the NullableEnumerationPropertyConvention has this:
>
> >         public bool Accept(IProperty target)
> >         {
> >             var type = target.PropertyType;
>
> >             return type.IsGenericType && type.GetGenericTypeDefinition
> > ().Equals(typeof(Nullable<>)) && type.GetGenericArguments()[0].IsEnum;
> >         }
>
> > I'll change it and report back...
>
> > On Apr 16, 3:30 pm, brendanjerwin <brendanjer...@gmail.com> wrote:
>
> > > This issue seems familiar to me, but I don't see anything in my
> > > searches.
>
> > > My mappings that specify a UserType to handle my enumeration mappings
> > > seem to be ignoring the .CustomeTypeIs call.
>
> > >   Map(x => x.State,
> > > "ti_State").CustomTypeIs<Util.EnumToIntUserType<TransactionState>>();
>
> > > (EnumToIntUserType is a custome UserType I built)
>
> > > The hbm is outputting:
>
> > >   <property name="State"
> > > type="FluentNHibernate.Mapping.GenericEnumMapper`1
> > > [[Clearwave.Models.Eligibility.TransactionState, Clearwave.Models,
> > > Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]],
> > > FluentNHibernate, Version=0.1.0.0, Culture=neutral,
> > > PublicKeyToken=8aa435e3cb308880">
>
> > > Notice that the type is the GenericEnumMapper instead of my UserType.
>
> > > Does this ring any bells for anyone?
--~--~---------~--~----~------------~-------~--~----~
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