I tried but they are clueless :) Seriously though I was suggested it "might" be possible by Paul from fluent and to ask here. He suggested it might be "achievable" through join.
On Sun, Aug 23, 2009 at 6:38 PM, Tuna Toksoz <[email protected]> wrote: > Perhaps you should ask in Fluent nhibernate group < > [email protected]>, > > Tuna Toksöz > Eternal sunshine of the open source mind. > > http://devlicio.us/blogs/tuna_toksoz > http://tunatoksoz.com > http://twitter.com/tehlike > > > > > > On Sun, Aug 23, 2009 at 6:54 PM, Mikael Henriksson > <[email protected]>wrote: > >> I'll start with some code! >> >> public class Person >> { >> public virtual int Id { get; private set; } >> public virtual string FirstName { get; set; } >> public virtual string LastName { get; set; } >> } >> >> public class BoardMember : Person >> { >> public virtual Board Board { get; set; } >> public virtual MemberTypes Type { get; set; } >> } >> >> public class Chairman : BoardMember >> { >> >> } >> >> I want to inherit from person because a *board member *is a person. but I >> have different types of board members that I want to discriminate on. For >> instance Chairman should inherit from BoardMember. I know this might not be >> the best solution in this specific domain. I am mainly curious of if it is >> possible to do since I see a couple of problems: >> >> 1. Subclassing a class that is allready a subclass >> 2. Self referencing tables in a many to many situation >> >> My original attempt looks like the following (using fluent NH): >> >> public class PersonMap : ClassMap<Person> >> { >> public PersonMap() >> { >> Table("person"); >> Id(x => x.Id, "person_id"); >> Map(x => x.FirstName, "person_first_name"); >> Map(x => x.LastName, "person_last_name"); >> } >> } >> >> public class BoardMemberMap : SubclassMap<BoardMember> >> { >> public BoardMemberMap() >> { >> Table("board_member"); >> Map(x => x.Type).Column("board_member_type"); >> DiscriminateSubclassOnColumn("board_member_type"); >> } >> } >> >> public class Chairman : SubclassMap<Chairman> >> { >> public Chairman() >> { >> >> } >> } >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" 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/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
