CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

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

rated by 0 users
Answered (Not Verified) This post has 0 verified answers | 6 Replies | 2 Followers

Top 500 Contributor
40 Posts
Troncho posted on Mon, Apr 16 2012 11:59 AM

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!

 

All Replies

Top 10 Contributor
9,269 Posts

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.

Rocky

Top 500 Contributor
40 Posts

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

Top 10 Contributor
1,764 Posts

 

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.

Jonny Bekkum, Norway CslaContrib Coordinator

Top 10 Contributor
9,269 Posts

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.

Rocky

Top 500 Contributor
40 Posts
Troncho Smile [:)] replied on Tue, Apr 17 2012 12:51 PM

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 :)

Top 500 Contributor
40 Posts
Troncho replied on Tue, Apr 17 2012 12:55 PM

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

Page 1 of 1 (7 items) | RSS

Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems