It definitely shouldn't fail if you don't cast it, that's a bug. We're still not entirely decided on what the default behavior should be for enums, some say they should be stored as strings, others as ints. Either way though, it should default to one of them!
I've created an issue<http://code.google.com/p/fluent-nhibernate/issues/detail?id=240>that you can track. On Thu, May 28, 2009 at 8:02 AM, todd brooks <[email protected]> wrote: > > This works, but I would like to make sure I'm using the correct > syntax, as (in my naive opinion), it seems "wordy". > > I have a Parent class. it is discriminated based on an enum: > > public enum ChildType > { > ChildA = 0, > ChildB = 1 > } > > In my Parent mapping, I have this: > > DiscriminateSubClassesOnColumn("ChildType", (int)ChildType.ChildA) > .SubClass<ChildTypeA>((int)ChildType.ChildA, x => x.References(y > = y.ChildADetail)) > .SubClass<ChildTypeB>((int)ChildType.ChildB, x => x.References(y > = y.ChildBDetail)); > > Should I be casting the enums to int? It seems redundant to me, but > if I don't, it won't compile. > > I would think that it should look like this: > > DiscriminateSubClassesOnColumn<ChildType>("ChildType") > .SubClass<ChildTypeA>(ChildType.ChildA, x => x.References(y = > y.ChildADetail)) > .SubClass<ChildTypeB>(ChildType.ChildB, x => x.References(y = > y.ChildBDetail)); > > It would seem to me that Fluent should be able to determine the > datatype of the enum. > > Am I missing something obvious? Am I doing it correctly? > > Many thanks in advance. > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
