Enterprise Library
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: 1: public class Person 2: { 3: [NotNullValidator(MessageTe... Name is required.")] 4: [StringLengthValidator(50, MessageTemplate="First Name must be 1-50 characters.")] 5: public string FirstName { get; set; } 6: } But then when you run it in an ASP.NET application with the PropertyProxyValidator validation control provided by VAB, your business ......
Posted On Tuesday, June 10, 2008 9:27 PM | Comments (3)
Attaching Modified Entities in EF 4
Lately I’ve been working with EF 4.0 and finding that many of the new features are catching up with the features previously available in other framework like LINQ to SQL. One example of this is the ability to easily attach objects (for example, disconnected objects that come in from another tier). For example, imagine you had a web service where a consumer submitted an object to get saved – you’d want to instantiate a new context, attach the incoming entity, and save the object. In previous versions ......
Posted On Friday, November 27, 2009 10:12 PM | Comments (11)
FredNUG Code Samples
Thanks to everyone who attended my presentation last night at FredNUG.  The code samples can be downloaded here.
Posted On Thursday, August 27, 2009 12:30 PM | Comments (0)
Enterprise Library Validation Application Block with MVC Binders
A while back, I blogged about using the Enterprise Library Validation Application Block (VAB) with ASP.NET MVC. As MVC has matured as a framework, this scenario has becoming simpler. In early releases of MVC, I implemented the execution of the VAB validation in the controller methods. However, I now prefer to put that logic in the binders themselves. In earlier versions of the framework, the model binders that came out of the box dealt well with simple objects but if you had more complex View Models ......
Posted On Monday, March 16, 2009 11:17 PM | Comments (4)
Validation Application Block – Unit Test Validation Logic
The Enterprise Library Validation Application Block (VAB) is a great library for putting your validation in your business layer where it belongs rather than in the UI. It allows us to apply attributes to the properties of our business objects like this: 1: public class Person 2: { 3: [StringLengthValidator(1, 20, MessageTemplate="First Name must be between 1-20 characters.")] 4: public string FirstName { get; set; } 5: 6: [StringLengthValidator(1, 20, MessageTemplate="Last Name must be between 1-20 ......
Posted On Tuesday, January 27, 2009 10:27 PM | Comments (3)
Enterprise Library Validation Application Block with ASP.NET MVC
Several weeks ago (before the release of the CTP5 of MVC) I posted a way to leverage the EntLib Validation Application Block with MVC. Since then CTP5 has been released and this finally includes a mechanism for reporting validations. It is important to note that it does not include the mechanism for *how* to do validation but rather how to *report* validations. This is actually a great thing because, first off, it allows the flexibility to utilize whatever validation framework you please rather than ......
Posted On Saturday, October 4, 2008 10:15 PM | Comments (0)
Leverage EntLib Validation Application Block in MVC
UPDATE: This post is now out of date as of the CTP5 release of the MVC framework. For the lastest version, see this post here. One of the areas of MVC that is still an open area in development is how best to handle UI validations. There are numerous approaches currently being examined. MVCContrib Validator Toolkit for MVC The Enterprise Library's VAB is great because it allows you to specify all your validation logic in your business layer where it belongs rather than in your UI. Additionally, it ......
Posted On Tuesday, June 17, 2008 3:47 PM | Comments (3)
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 UI ......
Posted On Monday, June 16, 2008 3:19 PM | Comments (1)
EntLib Validation Application Block - Required String Validator
In a previous post 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: 1: [StringLengthValidator(1, 50, MessageTemplate="First Name must be 1-50 characters.")] But the problem is that the StringLengthValidator is really doing ......
Posted On Thursday, June 12, 2008 11:23 PM | Comments (10)

View Steve Michelotti's profile on LinkedIn

profile for Steve Michelotti at Stack Overflow, Q&A for professional and enthusiast programmers

Google My Blog

Tag Cloud