Skip to content

Instantly share code, notes, and snippets.

@jmarnold
Created September 7, 2010 22:21
Show Gist options
  • Save jmarnold/569255 to your computer and use it in GitHub Desktop.
Save jmarnold/569255 to your computer and use it in GitHub Desktop.
Rules
.IfProperty(p => p.Name.ToLower().Contains("email"), validate => validate.AsEmail())
.IfProperty(p => p.Name.ToLower().Contains("phone"), validate => validate.AsPhoneNumber());
Scan(x =>
{
x.TheCallingAssembly();
x.IncludeNamespaceContainingType<ModelMarker>();
x.UseValidationAttributes();
x.InheritValidationRules();
x.ByDefault
.IfProperty(p => p.Name.ToLower().Contains("email"))
.IsEmail();
x.ByDefault
.IfProperty(p => p.Name.ToLower().Contains("phone"))
.IsPhoneNumber();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment