Extending BrokenRule and BrokenRuleCollection

Extending BrokenRule and BrokenRuleCollection

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


sbrickler posted on Friday, February 22, 2008

   I was wondering if someone had some advice for this type of situation. I am trying to implement an VS style error list in my application that will hold all the errors, warnings, and messages that need to be addressed in my app. This collection would hold all the broken rules in the object graph as well as other errors that happen in the application, not necessarily tied to a BO. I was thinking of inheriting from the brokenrule and brokenrulecollecion but that isn't possible. The reason I was inheriting was to add a delegate property to the brokenrule class. This delegate would be triggered by someone clicking on the error in my error list in order to do some custom action to resolve the error. Is there a better way to do this? I was looking for a good way to utilize the existing broken rule functionality without having to roll my own.   

RockfordLhotka replied on Friday, February 22, 2008

There is a treeview control to display all that infomation on CSLAcontrib - Andres built and contributed it a while back. Even if it isn't directly useful to you, it might give you some ideas.

JohnB replied on Friday, February 22, 2008

We actually did what you've talking about. We created our own BrokenRulesCollection modeled from Csla that allows us to retrieve all broken rules for the parent object and any children easily. In our subclass of BusinessBase, we Overrode the BrokeRulesCollection property to use ours and by hooking into the Csla events we were able to implement the functionality you describe.

The solution we came up with works great and gives us the flexibility we need to manage the broken rules collection like we want.

HTH,
John

sbrickler replied on Friday, February 22, 2008

Thanks John, Is this something you can share with me? If not, I understand.  A few code snippets would help though.

Thanks again.

Copyright (c) Marimer LLC