Skip to content

Instantly share code, notes, and snippets.

@emiaj
Created December 28, 2012 17:04
Show Gist options
  • Select an option

  • Save emiaj/4399792 to your computer and use it in GitHub Desktop.

Select an option

Save emiaj/4399792 to your computer and use it in GitHub Desktop.
public class ShortCircuitFieldRule : IFieldValidationRule
{
private readonly IFieldValidationRule _inner;
public ShortCircuitFieldRule(IFieldValidationRule inner)
{
_inner = inner;
}
public void Validate(Accessor accessor, ValidationContext context)
{
if(!context.Notification.MessagesFor(accessor).Any())
{
_inner.Validate(accessor, context);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment