CSLA .NET 3.0 Beta 2 available for download

CSLA .NET 3.0 Beta 2 available for download

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


RockfordLhotka posted on Friday, June 22, 2007

CSLA .NET Version 3.0 Beta 2 is now available for download.

This is the final test release of version 3.0. Any changes between now and release will be bug fixes.

If you plan to upgrade please consider helping yourself and the community at large by downloading this version and testing it before July 5. Let me know about any issues through the forum.

CSLA .NET 3.0 provides support for Microsoft .NET 2.0 and 3.0.

If you want to build CSLA .NET 3.0 without .NET 3.0, you must define the NET20 symbol in the project properties.

CSLA .NET 3.0 includes enhancements useful to all 2.1.4 users, including these highlights:

Validation rules

·         PropertyFriendlyName – specify a friendly name to use when displaying broken rule text

·         Format – specify a format mask to use when displaying broken rule numeric values

·         StringMinLength – new validation rule method

·         DecoratedRuleArgs – useful for code generation of AddBusinessRules() methods

·         Fix bug with stopProcessing and rule priorities

·         RegEx – rule method now supports options for dealing with null values

Authorization

·         New CanExecuteMethod() functionality, similar to CanReadProperty() and CanWriteProperty()

Undo and Data binding

·         If edit levels get out of sync an exception is thrown, making debugging of Windows Forms data binding much easier

Interfaces

·         Cleaned up and rearranged interfaces to provide more consistency – making it easier to create UI frameworks on top of CSLA business layers

SmartDate

·         Added TryParse() method

·         Fix bug with CompareTo() method

SortedBindingList and FilteredBindingList

·         Allow access to underlying source list

ProjectTracker\PTWin

·         Reworked data binding code to address all known issues

See the change log for a complete list of changes.

Of course the primary focus of CSLA .NET 3.0 is support for Microsoft .NET 3.0. Highlights include:

·         WcfProxy – a data portal channel that uses WCF. You can transparently move from any existing data portal channel to WCF by using this new proxy.

·         DataContract – support for using the WCF DataContract and DataMember attributes in your business classes

·         WPF

o   CslaDataProvider – a data provider control that can create, fetch, save and cancel edits on a CSLA .NET business object. In some cases this can lead to code-less data entry forms!

o   Validator – a control that provides Windows Forms ErrorProvider-like behavior to WPF forms that are data bound to CSLA .NET objects.

o   Authorizer – a control that provides Windows Forms AuthorizeReadWrite-like behaviors to WPF forms that are data bound to CSLA .NET objects.

o   ObjectStatus – a control that exposes IsValid, IsSavable and other properties from a CSLA .NET business object so they can be used by XAML data binding.

o   IdentityConverter – a value converter that can be used to work around an issue with data binding and refreshing the UI.

ProjectTracker\PTWpf

·         Added new WPF UI with equivalent functionality to PTWin.

ProjectTracker\PTWorkflow

·         Added new Workflow UI to illustrate how a workflow can use CSLA .NET business objects

ProjectTracker\PTWcfClient and PTWcfService

·         Added a WCF service illustrating how to expose CSLA .NET objects through WCF/SOA

·         Added a WCF client app illustrating how to call a WCF service

ProjectTracker\WcfHost

·         Added a WCF host for the data portal

RockfordLhotka replied on Friday, June 22, 2007

Well copying and pasting from Word didn't work so well, sorry about that.

You can go to my blog to get a version that's easier to read:

http://www.lhotka.net/weblog/CSLANET30Beta2AvailableForDownload.aspx

claptik replied on Tuesday, June 26, 2007

Rocky,

I like how you added the PropertyFriendlyName to ruleargs.  Would it also make sense to also do this for the common rule args (MaxLengthRuleArgs, etc.)?

Thanks.

RockfordLhotka replied on Tuesday, June 26, 2007

All rule args classes like MaxLengthRuleArgs inherit from RuleArgs, so all custom rule args (yours, mine, everyone’s) just got PropertyFriendlyName, along with the Shared/static GetPropertyName() helper method that can be used to get the property name (friendly first, and if it doesn’t exist then normal property name).

 

Look at CommonRules for examples.

 

Rocky

 

From: claptik [mailto:cslanet@lhotka.net]
Sent: Tuesday, June 26, 2007 12:40 PM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] CSLA .NET 3.0 Beta 2 available for download

 

Rocky,

I like how you added the PropertyFriendlyName to ruleargs.  Would it also make sense to also do this for the common rule args (MaxLengthRuleArgs, etc.)?

Thanks.


claptik replied on Wednesday, June 27, 2007

Thanks Rocky,

I do now see the PropertyFriendlyName property on MaxLengthRuleArgs.  I think what I was getting at was asking whether there was a constructor overload that accepted a PropertyFriendlyName parameter so I could do this (similar to how the ruleargs constructor works):

ValidationRules.AddRule(CommonRules.StringMaxLength, new CommonRules.MaxLengthRuleArgs("PropertyName", "FriendlyName", 50));

instead of having to do this:

CommonRules.MaxLengthRuleArgs args = new CommonRules.MaxLengthRuleArgs("ProperyName", 50));
args.PropertyFriendlyName = "FriendlyName";
ValidationRules.AddRule(CommonRules.StringMaxLength, args);

when defining each rule.  It works fine now doing it the latter way but maybe I'm missing something as I couldn't figure out how to do it in one line of code.

petervdm replied on Wednesday, June 27, 2007

All I did was to extract those lines into a new method:

 public static CommonRules.MaxLengthRuleArgs GetMaxRuleArgs(string propertyFriendlyName, string propertyName, int maxLength)
        {
            CommonRules.MaxLengthRuleArgs maxLengthRuleArgs = new CommonRules.MaxLengthRuleArgs(propertyName, maxLength);

            maxLengthRuleArgs.PropertyFriendlyName = propertyFriendlyName;
            return maxLengthRuleArgs;
        }


and then calling them like this:

ValidationRules.AddRule(CommonRules.StringMaxLength, CommonValidationRules.GetMaxRuleArgs("Details", "Sought", 4000));

Peter

pirithoos replied on Monday, June 25, 2007

...

If you want to build CSLA .NET 3.0 without .NET 3.0, you must define the NET20 symbol in the project properties.

...

Hmmm, can you please explain how to define the NET20 symbol? I cannot find that option in the project properties.

Best Regards

Frank

petervdm replied on Monday, June 25, 2007

Hi Frank,

Not sure if you are using VB or C# but the instructions should be similar:

1. For C#, Open up the Project Properties (Right -Click on the project in Solution Explorer and click Properties)
2. Click on the Build tab
3. In the Conditional compilation symbols text box enter NET20
4. Compile

That should sort it out.

Peter

Matthew Sorvaag replied on Tuesday, July 03, 2007

Hi Rocky,

I am testing out the beta and have a question to ask...

I am skinning my controls so when there is a validation error, I am giving it a red border with rounded corners similar to the way CSLA does it.

How would I go about modifying/overriding the CSLA validator styles? I am doing this on textboxes at the moment.

Thanks,

Matt

ajj3085 replied on Thursday, July 05, 2007

hey Matt,

I'd think you'd create an ExtenderControl, similar to the ErrorProvider component that Rocky build for Csla.   Check out the code for that, you shouldn't need to modify  your BOs or Csla.net at all.

HTH
Andy

RockfordLhotka replied on Friday, July 06, 2007

Matthew Sorvaag:

I am testing out the beta and have a question to ask...

I am skinning my controls so when there is a validation error, I am giving it a red border with rounded corners similar to the way CSLA does it.

How would I go about modifying/overriding the CSLA validator styles? I am doing this on textboxes at the moment.

This is in WPF I assume? You do this using normal styling and a trigger. The technique is exactly the same as you'd use for changing the style of a control based on an exception or other error. Paul Stovell has a good article on the concepts:

http://www.codeproject.com/WPF/wpfvalidation.asp

GlennMiller replied on Monday, July 09, 2007

We are using Beta 2 for a WPF app.

For the most part everything is working great!

We did find one issue. Don't use reserved words for property names!

We had a property called Value. We had an instance rule for Value.

What would happen is when it hit the Validator.ErrorScan() things would go very wrong. Not only did our textbox "Value" become flagged with an error (correctly), but all our combo boxes had a small red box directly around the text (not the entire combo).

I don't know if I would categorize this as a bug. But maybe a developer assumtion? Our solution was to rename the property to something else. Just incase anyone else runs into this we thought we should post this.


RockfordLhotka replied on Monday, July 09, 2007

Did the combobox contain items of that same type that had a Value property?

 

Or more specifically, can you provide more detail here? Or even better some sample code or a repro?

 

If it is a bug I’d like to find/fix it.

 

Rocky

 

 

From: GlennMiller [mailto:cslanet@lhotka.net]
Sent: Monday, July 09, 2007 12:44 PM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] CSLA .NET 3.0 Beta 2 available for download

 

We are using Beta 2 for a WPF app.

For the most part everything is working great!

We did find one issue. Don't use reserved words for property names!

We had a property called Value. We had an instance rule for Value.

What would happen is when it hit the Validator.ErrorScan() things would go very wrong. Not only did our textbox "Value" become flagged with an error (correctly), but all our combo boxes had a small red box directly around the text (not the entire combo).

I don't know if I would categorize this as a bug. But maybe a developer assumtion? Our solution was to rename the property to something else. Just incase anyone else runs into this we thought we should post this.




Copyright (c) Marimer LLC