Skip to content

Instantly share code, notes, and snippets.

@emiaj
Created August 30, 2012 00:07
Show Gist options
  • Select an option

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

Select an option

Save emiaj/3520765 to your computer and use it in GitHub Desktop.
public class SomeRule : IValidationRule
{
private readonly ISomeService _service;
public SomeRule(ISomeService service)
{
_service = service;
}
public void Validate(ValidationContext context)
{
if (!_service.IsValid())
{
context.Notification.RegisterMessage(StringToken.FromKeyString("SomeRule"));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment