Hi,
Being pretty new to the CSLA framework I find myself lost in design issues. I have designed the architecture of a sizeable application which I am trying to develop. The major business objects are done and so is the database.
I would like to share my ideas and need some help with the code. One issue is that of having a root BusinessBase object with child BusinessBase objects apart from child BusinessListBase objects. How do I implement the save (insert and update) operations in such an architecture? Kindly email me at silaspeter@gmail.com so I could forward the code under discussion.
Cheers to Rocky and the believers.
So you have an editable root, which directly contains an editable child? Here's the basic pattern:
public class EditableRoot : BusinessBase<EditableRoot>
{
// ...
protected override void DataPortal_Update()
{
using (SqlConnection cn = ...)
{
// ...
if (_child.IsDeleted)
{
if (!_child.IsNew)
_child.DeleteSelf(this, cn);
_child = EditableChild.NewEditableChild();
}
else if (_child.IsNew)
_child.Insert()
else
_child.Update()
}
}
}
public class EditableChild : BusinessBase<EditableChild>
{
// ...
private EditableChild()
{
MarkAsChild();
}
internal void Update(IParent parent, SqlConnection cn)
{
// ...
MarkOld();
}
}
Thank you so much Rocky.
Miracles do happen!!
Hi,
Does it make sense to create code for an object that can optionally be used as child or root. Something like being able to switch it between being a child and root. If it does then what would the basic template be.
Something like clubbing the code for Resource Object and the ProjectResource Object and then being able to serialze only the necessary bits based on the context of use.
This could be a completely wrong idea , am I breaking the normalization rules for the BOs? Please give me some pointers. err, I'd be heading down a oneway street ...
Regards,
Silas.
Dear Rocky,
Apologies for being off the radar. Thank you for the pointers. Thanks to the contributions made and found on codeplex.
~Silas~
Copyright (c) Marimer LLC