I have resently started working for a company using CSLA. I have been referencing the sample projects heavily trying to understand good oo design principles and CSLA. I have been having a discussion with my co worker about proper use of encapsulation and how best to implement this.
In the sample ProjectTracker.Library there is the ResourceAssignmentEdit class. In that class there is a reference to the ProjectName and ProjectID. Why are these individual properties instead of a property for the ProjectEdit class. It seems like the Project Name and ID are attributes of the Project and the resource assignement uses them but should not contain them.
Should there be a reference to the Project Edit object in the Resource Assignment object? If not how does apply to encapsulation.
This is where you quickly get into trouble with serialization and you must understand how CSLA handle ownership.
CSLA defaults to owning references. F.ex when you call BeginEdit the object creates a snapshop if itself and all its children. Imagine what happens when you have circular references.
Or imagine how serialization in a N-tier deployment must be handled.
In the Using CSLA 4: Creating Business Objects you will find documentation of
and how to implement these.
Copyright (c) Marimer LLC