Hi there,
I hope someone can give me some input, i am close but i have been following the book and everything fits into place just about but I came across 2 questions, heres an outline.
I have been creating one of EditableBusinessBase classes, working good. I basically have private variables like
Guid _id;
string _propertyName = string.empty;
int _plotSize;
Do i need to initialise _plotSize to a number? I know i have to with strings, as it states in the book because it doesn't bind if its null but what about a number?
Then my other question is with regards to a property on a businessBase class. I have various public properties (get/set) like this which show the contents of the private members like _id, _propertyName etc etc
public string PropertyName
{
get {....}
.
.
All fine and now i need another property (get/set) that will be "Property Type" which will contain things like "house", "office", "farm house", "land", "apartment" etc.. so I presume i need to create another BusinessEditableBase for property types this i am ok with... but then how do i create the property on my original EditableBase class above, i could put
private MyNewEditableBase.PropertyTypes _propertyTypes; // But this is tightly coupled isn't it?
public MyNewEditableBase.PropertyTypes PropertyTypes
{
get{ ..}
.
.
But this would tightly couple the 2 objects wouldn't it?? And the other question that i keep thinking about when reading other parts of Rocky's book is that yes i do need a EditableBase for this propertyType as i need to Edit / Add records but i presume when I will use it from another BussinessObject then I would use a ReadOnlyList as it acting like an ENUM - is this correct?
I don't think i need some kind of Assignment type object like in the
csla.net book as its only a 1 to 1 relationship... It is a real
estate(property) record and one the of fields/properties on the object
will be of a type "MyNewEditableBase" o similar.
As you can see, I am a little lost, can anyone give me a little input.
Thanks in advanceYou can have an editable root directly contain an editable child, that is fine. The property in the editable root that allows access to the child should be a read-only property, because you don't want the UI to change that reference, only gain access to the child object.
The idea of containment (or aggregation) is at the core of object-oriented design. Objects contain other objects all the time, this is not a bad thing. In fact, it is a way to express important relationships between objects.
In most cases this is not a form of tight coupling. The root object is aware of its child, but probably won't interact with it very much. The child object may be entirely unaware of its parent.
Regarding your list of property types, this is the purpose behind NameValueListBase. You can use NVLB to create an object that represents a list of name/value pairs, typically loaded from the database or a configuration file.
Copyright (c) Marimer LLC