Sponsored By Aspose - File Format APIs for .NET

Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!

Validation Application Block Presentation and New Features – Enterprise Library 3.0

Validation Application Block Presentation and New Features – Enterprise Library 3.0

by David Hayden

 

I presented the new Validation Application Block in Enterprise Library 3.0 last night to the Sarasota .NET Developers Group. An expected 1 hour presentation turned into 2 hours as we had a lot of really good discussion on the new block and Enterprise Library 3.0 as a whole. I expect a number of developers will be downloading the latest Enterprise LIbrary 3.0 CTP today based on our discussions last night.

The January CTP was just released on Friday and has a couple of new goodies in it for the Validation Application Block that I added to my list of demos for the presentation.

 

ASP.NET Integration

Tom mentioned this in an earlier post and you can find a quickstart in the downloads, but this feature is worth repeating :)

There is a new webcontrol that comes with the Validation Application Block called the PropertyProxyValidator. You can find it in the following assembly:

Microsoft.Practices.EnterpriseLibrary.Validation.Integration.AspNet.dll

The purpose of this control is to avoid duplicating your validation rules in 2 places- your web forms and your business classes. Instead of using ASP.NET Validation Controls to repeat the same validation rules on input controls that will be validated again with the same rules on the business class properties they represent, you can instead use the new PropertyProxyValidator control that reads the rules from the business class itself, saving you the step of creating redundant rules and the maintenance headache of managing rules in multiple places.

Here is an example using ValidatorAttributes, but you could also put your validation rules in an external configuration file.

 

Winforms Integration

You get similar functionality in the Winforms environment with the addition of a new Winform Control, called ValidationProvider, located in the following assembly:

 Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WinForms.dll

Again, you just map each UI control to the appropriate business class property to get the validation rules to avoid creating rules in multiple places.

 

 

Visual Studio Integrated Configuration Editor Support

The group was also impressed with the new Configuration Editor for Enterprise Library built right into Visual Studio. The editor now supports the Validation Application Block in the new release:

 

 

 

One of the really valuable features of the editor with the Validation Application Block is that you can use it to discover and select types and properties in your application to save you a lot of manual typing:

 

 

 

Conclusion

Thanks to everyone who attended my presentation. I appreciated all the great discussion about Enterprise Library and the positive feedback on my presentation!

 

by David Hayden

This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

4 Responses to Validation Application Block Presentation and New Features – Enterprise Library 3.0

  1. dhayden says:

    Roger,

    I was able to recreate the error by specifying an incorrect class name, so I think there is something wrong with the fully qualified class name in your ValidationProvider Settings.

    Take a look at the quickstart that is included in the Enterprise Library 3.0 source code. Perhaps looking at the settings in the ValidationProvider will help.

    In the example I created for my presentation, the SourceTypeName is

    WinformIntegration.Customer, WinformIntegration

    which represents the fully qualified class name.

    Regards,

    Dave

  2. Roger Williams says:

    I’ve had difficulty getting the Winforms ValidationProvider control to work properly. When it attempts to validate a Textbox that was set to use the validator control, it thows an IllegalOperationException saying “The source type does not represent a valid type for validation provider.”

    I’ve filled the SourceTypeName property with the fully qualified (and correctly cased) class name that has the validation attributes in it.

    Any suggestions on where I’m going wrong would be greatly appreciated.

    Thanks

    Roger Williams

  3. dhayden says:

    Thanks, Steven. I had a lot of fun presenting the material. Thanks for all the great questions, too!

  4. That was a great presentation last night David – good slides, good demos and you obviously really knew the material and were excited about it. Kudos.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>