Hi all,
First of all thanks for your responses.
I have read whole documentation regarding polymorphism in the link provided
by Roger, ;) and I have got the solution.
Have a nice day.
PD: PeteA, in my case i wanna mix different type of animals in same group,
that was the main question. I think it's very useful to treat a lot of
problems.
PD: Roger, you didn't put any link. I will check anyway if you finally post
here.
El miércoles, 13 de marzo de 2013 16:28:00 UTC+1, mouthbow escribió:
>
> 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].
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.