I have an entity called
Process.
Process has a collection of
Procedures.
Process is also the factory for a
Procedure. Process looks like this:
Code:
public class Process{
...
IList Procedures{
get{...}
}
public Procedure CreateProcedure(string name){
Procedure operation = new Procedure(this);
operation.Name = name;
return operation;
}
...
}
Now my questions, should I add the Procedure to the Process's Procedures collection in the create operation or should I explicity add the Procedure to the Process after Creation?
In the Parent/Child example in the documentation, an AddChild method is used to simplify adding the child to the Parent's children collection and set the parent of the child. This makes sense but exposing the collection as a property off of the parent also exposes the collection's add method. So it could be confusing to a developer as to which method to call, AddChild() or parent.Children.Add(). How have others worked with this probelm? Is it something I should even be worried about?
It would be cool if the collection exposed events that could be tapped into. then you could trap for the add event and set the child's parent in the event.
If a child is added into a parent's collection is it better to update the parent in the session and let persistence by reachability take over or is it better design to explicity save the child directly to the session and persist it that way?
Thanks for any help.
Jesse