|
using System;
using System.Collections.Generic;
using System.Text;
// Need these to make it work
using Microsoft.Practices.EnterpriseLibrary.Validation;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;
namespace BusinessObjects
{
[HasSelfValidation]
public class SelfValidateAddress
{
[SelfValidation]
public void CheckState(ValidationResults results)
{
// Perform custom validation here
ValidationResult result = new ValidationResult("State not correct", this, null, null, null);
results.AddResult(result);
}
[SelfValidation]
public void CheckZipCode(ValidationResults results)
{
// Perform custom validation here
ValidationResult result = new ValidationResult("ZipCode does not match City", this, null, null, null);
results.AddResult(result);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.