CSLA 3.8.4: What are HasBrokenRulesEventArgs, CslaActionCancelEventArgs and CslaActionEventArgs intended for?

CSLA 3.8.4: What are HasBrokenRulesEventArgs, CslaActionCancelEventArgs and CslaActionEventArgs intended for?

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


Troncho posted on Monday, April 16, 2012

Hi everybody. I'm trying to get an automated way of showing errors on a WinForm app directly on the MainForm's StatusStrip, following the Project example. I'm not able to find an example anywhere. And I cannot find example usage of What are HasBrokenRulesEventArgs, CslaActionCancelEventArgs and CslaActionEventArgs.

Where can I get some advice on these?

Thanx!

 

RockfordLhotka replied on Monday, April 16, 2012

The best way to get validation result information from a business object is to go directly to the object and use IDataErrorInfo (just like data binding does), or to use the BrokenRulesCollection property on the object to get a full collection of all broken rules - against which you can use LINQ queries to do filtering and other manipulation.

If you are doing something for the status bar in a UI, I would expect you'll get the best results by doing a LINQ query directly against the business object's broken rules collection.

Troncho replied on Monday, April 16, 2012

Hi Rocky, thanks for your quick response :)

I'll try what you are advising me here. I'v written some code to get the 1st broken rule against the Broken Rules List in order to work as an example on a particular UC managing editing of a BusinessBase class. Works nice. Now, my goal is to extend it directly to the Main Status Bar.

Never thought of using Linq against the Broken Rule list, and U R RIGHT! I'll defenitively gonna give it a try.

I'll tell you the results when I'm done.

BTW, those special EventArgs classes defined in CSLA, are they ment 4 something special?

Thanks again Rocky :)

Troncho

JonnyBee replied on Monday, April 16, 2012

 

Hi,

You may also look at ErrorTreeView in http://cslacontrib.codeplex.com/SourceControl/list/changesets 

Download the latest source code and then goto : $\Branches\2010.11.001\ErrorTreeView

That project is in VB but once compiled can easily be converted to C# with IlSpy 2.0 (take compiled code and save as new C# Project).
http://community.sharpdevelop.net/blogs/christophwille/archive/2012/04/15/ilspy-2-0-final.aspx

Remember that when you have parent-child-grandchild with broken rules each object holds is own list of broken rules.

Troncho replied on Tuesday, April 17, 2012

Thanks for your advice Jonny Smile

I'll download the suggested code and convert it 2 C#.

CSLA is really an excelent business framework, and it gets even better the more I dig in.

I'll try and master most of the CSLA WinForm interface during the following months and then I'll buy what you and Rocky suggest as 2 move forward 2 CSLA 4 (reading, examples, etc.)

Thanks again!

Troncho

RockfordLhotka replied on Tuesday, April 17, 2012

Troncho

BTW, those special EventArgs classes defined in CSLA, are they ment 4 something special?

They are used by the custom events declared and raised by CSLA. If you handle the right events, you'll find that those EventArgs subclasses are passed to the event handler as a parameter.

Troncho replied on Tuesday, April 17, 2012

Thanks again Rocky. I was searching the CSLA project with the Solution Navigator which didn't find any reference to those ...EventArgs. Now that you told me this, I see that the Sol.Navitagor doesn't perform a deep search. I've done a deep search in CSLA and found what you are talking about :)

Copyright (c) Marimer LLC