Hi,
I've worked my way through most of the Expert C# 2005 Business Objects book and am about to start my first project using CSLA 2.0.2. However there are still 2 issues that I'm not clear on even after reading through the same issues on searchcsla.com.
Part of my object hierarchy looks like this
UnderwritingEnquiry (EditableRoot)
-> Applicants (EditableChildCollection)
-> Applicant (EditableChild)
-> AddressHistory (EditableChildCollection)
-> Address (EditableChild)
1) Loading grandchildren
It seems that a lot of people are using an extension developed by a member of the forum (SafeRowReader) for populating object graphs more than two levels deep. I can't seem to find an example of using this code or the actual class itself (attachments to posts don't seem to be available from searchcsla.com). Surely something this common should be added to the framework and explained in the book, or at the very list shown in the example ProjectTracker application?
2) Severity of business rules
Again this seems to have been solved by multiple members of the forum in different ways but I can't seem to find any code. The default implementation in CSLA automatically stops an object from being saved if any business rules are broken. This does not seem granular enough for a lot of business cases. For instance in my model, these are some of the business rules
i) An applicant must have a name and telephone number.
ii) An applicant must have at least 3 years address history.
If rule i) is broken then the object should be prevented from being saved. However if rule ii) is broken then the object should still be allowed to be saved even though the error should still be displayed to the user. By default, the UI developer shouldn't have to worry about the difference between the different severitiy levels unless they have a specific requirement.
Any help tracking down the code that is alluded to on searchcsla.com would be much appreciated.
Thanks,
Coxy.