Forgot to check if property is ReadOnly this code would be more
appropriate:

 if (property.CanWrite)
 {
      if (property.PropertyType.IsEnum)
           return true;

       return property.PropertyType.Namespace == "System";
 }


On 18 mar., 14:42, "gre...@slavec.net" <gre...@slavec.net> wrote:
> The problem is in method MapsProperty of class AutomMapColumn
>
> This line:
>
>  if (property.CanWrite)
>     return property.PropertyType.Namespace == "System";
>
> will return false for enums and they will therefore be skipped.
>
> I think a check if a type is an enum should be added before this line,
> like this:
>
> if (property.PropertyType.IsEnum)
>     return true;
>
> Is this correct?
>
> On 18 mar., 14:02, "trull...@googlemail.com" <trull...@googlemail.com>
> wrote:
>
> > Looks like this answers my post a moment ago
>
> >http://groups.google.com/group/fluent-nhibernate/browse_thread/thread...
>
> > Andrew
>
> > On Mar 18, 12:43 pm, "gre...@slavec.net" <gre...@slavec.net> wrote:
>
> > > Enums members in entities are skipped when automaping is used.
>
> > > I found this test in AutoMap tests:
>
> > >  [Test]
> > >         public void ShouldAutoMapEnums()
> > >         {
> > >             Model<ExampleClass>(model => model
> > >                 .ForTypesThatDeriveFrom<ExampleClass>(mapping =>
> > >                     mapping.Map(x => x.Enum).SetAttribute("type",
> > > "Int32"))
> > >                 .Where(type => type == typeof
> > > (ExampleClass)));
>
> > >             Test<ExampleClass>(mapping =>
> > >                 mapping.Element("//proper...@name='Enum']").Exists());
> > >         }
>
> > > I wonder if this is the expected functionality, since in this test
> > > enum is explicitly mapped (and not automaticly).
> > > Is this a bug or expected behaviour?
--~--~---------~--~----~------------~-------~--~----~
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