EntLib Validation Application Block - Subclassing PropertyProxyValidator for ValueConvert

The Enterprise Library VAB provides the PropertyProxyValidator for ASP.NET applications so that you can attach it to a single control and it will display any validation messages for that business object property.  This automatic UI validation is great because it avoids duplicating your business layer validation logic in your UI.  Additionally, you can just use ONE validator control whereas using traditional ASP.NET validation controls you might need to attach 3-4 validation controls to a single...


EntLib Validation Application Block - Required String Validator

In a previous post [http://geekswithblogs.net/michelotti/archive/2008/06/10/122780.aspx] I discussed validating strings with the VAB in the context of ASP.NET applications.  In summary, you must have a NotNullValidator and also a StringLengthValidator that prevents a string length of zero on the lower bound and prevents a string length above your upper bound (e.g., 50 characters).  That attribute might look like this: [StringLengthValidator(1, 50, MessageTemplate="First Name must be 1-50 chara...


EntLib Validation Application Block - Validate a string in ASP.NET

You've created a class like this and all your unit tests pass just fine when you check for null strings or strings greater than 50 characters: public class Person { [NotNullValidator(MessageTemplate="First Name is required.")] [StringLengthValidator(50, MessageTemplate="First Name must be 1-50 characters.")] public string FirstName { get; set; } } But then when you run it in an ASP.NET application with the PropertyProxyValidator validation control provided by VAB, your business o...


CMAP Presentation - C# 3.0 Language Features Code Samples

The code samples from my recent presentation at the CMAP Main meeting can be downloaded here:C# 3.0 New Language Features [https://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=michelotti&ReleaseId=985] . The direct download link is here [http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=michelotti&DownloadId=1907] ....


CMAP Presentation - C# 3.0 Language Features

This Tuesday I'll be giving of presentation on C# 3.0 New Language Features at the CMAP Main Meeting: www.cmap-online.org/Meetings/Details/2008-05-06.aspx [http://www.cmap-online.org/Meetings/Details/2008-05-06.aspx] .  This is CMAP's .NET 3.5 Launch Event....