Validation

Validation

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


culprit posted on Wednesday, May 20, 2009

I just switched from 3.0.3 to 3.0.5, and am now having an issue with validation rules that worked before. It appears that all string max rules fail on fields that have strings made up of only numbers. This is not only an issue with phone numbers but also with product ids. Could someone please assist me with this?

Also the validation rule fails with a string max length rule where the length is below the max set of 75. Here is the value I am testing with: "WYETH PHARMACEUTICALS, INC.".

culprit replied on Wednesday, May 20, 2009

I have noticed that what is failing on these "CommonRules.StringMaxLength" rules is the "DataPortal_Fetch" function. Is there some way I can force the rules to accept a string of only numbers as a string?

culprit replied on Thursday, May 21, 2009

Rocky, I am obviously spoiled by all the incredible help you have given me previously or I am just growing more impatient with age. It is clearly the second option as I see you heavily involved in your forums still today, which is awesome.

Well, I found the problem here as well. The newer version is case sensitive with regards to the property names in the validation rule creation. This is probably a good thing and certainly makes the code cleaner, but stumped for a bit on rules that suddenly would not work that worked before.

BTW, I have ordered your latest book, but I wonder if you might answer a quick query. It is probably spelled out in the book, but if I keep my code essentially the same for our BOs which are targeting .Net 2.0, will it work with the latest CSLA and targeted against .Net 3.5?


JoeFallon1 replied on Thursday, May 21, 2009

I upgraded from 2.0.x to 3.5.x a few months ago. The changes to BO code were minimal. Nothing like the huge pain going from 1.x to 2.x. I think AddDependentProperty was made obsolete because Rocky fixed a typo and expects you to use the new version! That was about it.

Joe

culprit replied on Thursday, May 21, 2009

Joe,
I think we might release a beta first in 2.0, but I would like to change soon. I really appreciate you sharing your experiences.

RockfordLhotka replied on Thursday, May 21, 2009

The changes from 2.0 to 2.1 were a little more substantial, because of serious (and important) changes to the business and authorization rule subsystems. The CSLA .NET Version 2.1 Handbook ebook is a good resource to understand all those changes.

From 2.1 to 3.0 wasn't so dramatic. Most of the focus on 3.0 was support for WPF, WCF and WF. There are some bug fixes, and a small number of breaking changes as Joe mentions. Though if you use Windows Forms you may find that CSLA now throws some exceptions - revealing long-standing bugs in most people's UI code.

From 3.0 to 3.5 is not dramatic at all. There are a small number of potential breaking changes. The big thing is the introduction of a much more concise way of declaring properties and a bunch of new data portal features that seriously reduce your coding burden and increase consistency. Those features are optional - but using them does require quite a lot of changes to your code (mostly ripping out stuff you don't need any more).

From 3.5 to 3.6 is pretty straightforward. The focus here was on support for Silverlight. On the Windows/.NET side this mostly means adding new features for async data access, async validation rules and so forth. Things that are optional and only impact you if you decide to use them.

Of course every version brings bug fixes and minor enhancements - I'm only covering highlights. The individual change logs for each intermediate version should be reviewed to understand breaking changes, new features and bug fixes.

The Expert 2008 Business Objects book covers 3.6. If you need to understand some of the intermediate functional additions you may need the ebooks from http://store.lhotka.net for the 2.1 and 3.0 versions. They do have focused content that isn't in the 2008 book, but that may be relevant to someone upgrading from 2.0.

culprit replied on Thursday, May 21, 2009

Rocky,
Thanks so much for your very concise summary of the changes. Yes, I have kept up with your electronic books, but just got your latest book, and will be upgrading my code soon. I looked for it on audio, but no luck.

Just gleaning your book I am trying to determine the most efficient way to upgrade my existing BOs. I am thinking a quick way might be to use the latest templates and implement only the differences between the two BOs. Or do you have another way that I can see only the changes I would make to bring my BO code up to the latest, most efficient code. (FYI: I am currently on 3.0.5 of CSLA targeted to .Net 2.0)

Rob

RockfordLhotka replied on Friday, May 22, 2009

If you are using code generation then I would absolutely consider doing as
you suggest. That could be a big time saver.

Copyright (c) Marimer LLC