Is it possible to implement Root - Child Dependent Properties?

Is it possible to implement Root - Child Dependent Properties?

Old forum URL: forums.lhotka.net/forums/t/7353.aspx


Adnan posted on Tuesday, July 28, 2009

Using CSLA 3.0.5 and 'Per-Type' rules only.

How would you implement a dependent property between a root object and the child object in a nested child collection?

For example, 'Project' BusinessBase root object has a 'Tasks' (BusinessListBase) child collection which is a collection of 'Task' (BusinessBase) objects.

'Project' object has a 'StartDate' property, and Task object has a 'TaskDate' property. You want to make sure that when you add a Task object that you enter/check whether the 'TaskDate' is greater than or equal to the Project.StartDate.

I know you can add dependent properties within an object; but, not sure of this use case.

I appreciate any help or direction to examples in this matter.

Thanks.

Vinodonly replied on Wednesday, July 29, 2009

chk this post

http://forums.lhotka.net/forums/thread/34849.aspx

JoeFallon1 replied on Wednesday, July 29, 2009

Well, technically you can't make them dependent properties. That only works on a given BO. A key thing to do would be to write a rule in the Parent BO which loops over all the children and compares the dates. Then if they are out of line you can say which child BO has an issue. But the single rule exists only in the parent. Be sure to re-check that rule prior to calling save. It is either re-check the one rule or try to wire up all the events from the children to run in the parent. I would rather just re-check the rule.

Joe

 

Copyright (c) Marimer LLC