For example, I have entity with one to many relation: Department has
many Units:
class Department
{
public decimal Id{get;set;}
public IList<Unit> Units{get;set;}
}
class Unit
{
public decimal Id{get;set;}
public Department {get;set;}//Parent
}
If I want add new Unit:
Unit newUnit =new Unit{Department=someDepartment};
session.Save(newUnit);
So, if I already have parent Department, it's Units collection isn't
updated automatically, I must add it manually:
someDepartment.Units.Add(newUnit);
Same is with entity deletion:
Unit deletedUnit = someDepartment.Units[0];
session.Delete(deletedUnit);
deletedUnit.Department.Units.Delete(deletedUnit);
Is this ok? Maybe there is more convenient way to do this?
--
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.