I assume what you're trying to do is have a Person table, and a BoardMembers
table, with BoardMember being a joined-subclass, and then any derived
BoardMember's being discriminated...?

If that is the case, then I'm afraid you're out of
luck. Unless somebody knows otherwise, I'm pretty sure you can't do
that with NHibernate. You'll need them to all be in the same table and
call DiscriminateSubclassesOnColumn in your ClassMap.

On Tue, Aug 18, 2009 at 8:42 PM, Mikael Henriksson <[email protected]>wrote:

> I have many classes but only three is important for what I am trying to do.
> Let's say I have a person:
>     public class Person
>     {
>         public virtual int Id { get; private set; }
>         public virtual string FirstName { get; set; }
>         public virtual string LastName { get; set; }
>     }
>
> Now 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 that inherits from BoardMember:
>     public class BoardMember : Person
>     {
>         public virtual Board Board { get; set; }
>         public virtual MemberTypes Type { get; set; }
>     }
>
>     public class Chairman : BoardMember
>     {
>
>     }
>
> Now I thought I would do something like:
> 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()
>         {
>
>         }
>     }
>
> However DiscriminateSubclassOnColumn is not available within SubclassMap so
> how do I work around it? :)
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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