Hi Giovanni.
So, Family looks like;
public class Family
{
public Person Father{get;set;}
public IList<Person> Members{get;set;}
}
I'd introduce a method like this (or just code it in Father property set
method)
public void SetFatherForFamily(person newFather)
{
var familyMember = from m in Members where m.Id == person.Id select m;
if (familyMember!=null)
{
Father = newFather;
return;
}
throw new FatherMustBeFamilyMemberException();
}
this way you keep a DDD style...
Thanks
2011/2/10 Giovanni Bassi <[email protected]>
> Hi guys,
>
> Let's say I have a class Family, which has a collection of Persons,
> the members of the family (father, son, etc).
> I need to be able to get all my family members through the Members
> property of the Family class.
> And I also need to know specifically who the father of the family is.
> So I need an association from the Family class to the Person class,
> through the Father property. The father should also be in the Members
> collection. I should be able to change who the father is, set a new
> father if I need to.
> I haven't found any elegant way to do this.
>
> All help is appreciated.
>
> Thank you,
>
> Giovanni Bassi
>
> --
> 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.
>
>
--
Paulo Quicoli
Editor Técnico: .NET Magazine, ClubeDelphi Magazine; Editor: WebMobile
Magazine
www.devmedia.com.br
www.nhibernatebrasil.net
http://pauloquicoli.spaces.live.com
twitter:@pauloquicoli
--
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.