http://nhforge.org/doc/nh/en/index.html#inheritance-tableperconcrete


From: [email protected] [mailto:[email protected]] On Behalf Of 
mouthbow
Sent: den 13 mars 2013 16:28
To: [email protected]
Subject: [nhusers] Mapping property of BaseClass type

Hi, I'm trying to make this mapping and I think it must be simple but I'm not 
getting the way.

Suppose in one side I have three clases:

-Animal
-Dog : Animal
-Cat : Animal

public abstract class Animal {
        public Guid Id { get; set; }
        public String Name { get; set; }
    }

public class Dog : Animal
{
     public datetime WalkHour  {get; set;}
}

public class Cat : Animal
{
     public int MeaowCount {get; set;}
}



And in the other side I have other two classes:

-AnimalGroup
-AnimalGroupMember


public class AnimalGroup
{
        public Guid Id { get; set; }
        public String Name { get; set; }
}


public class AnimalGroupMember
{
     public Guid Id {get; set;}
     public Animal AnimalMember {get; set;}
}


As you can see, what I want is that my AnimalGroupMembers can be any kind of 
Animal but I want to get the correct type of Animal in the property 
AnimalMember (obviously casting to its type). I also need to keep separately in 
Database: one table for Cats and one Table for Dogs and I don't want to have 
any table called Animal.

Please help me in doing this, I really need this solution.

Thanks for reading and for helping.



--
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/nhusers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to