Feature | Is supported |
---|---|
Null safe | |
Validation | |
EF Core | |
EF 6 |
Validation result
Error
"String is invalid email".
"String is valid email" - for negation.
Info
Checks if string is valid email address.
Usage
var spec = Specification.Email();
spec.IsSatisfiedBy("john.doe@gmail.com"); // true
spec.IsSatisfiedBy("email.example.com"); // false
spec.IsSatisfiedBy(null); // false
As property
var customerSpec = Specification.Email<Customer>(c => c.Email);
customerSpec.IsSatisfiedBy(new Customer { Email = "john.doe@gmail.com" }); // true
customerSpec.IsSatisfiedBy(new Customer { Email = "email.example.com" }); // false
customerSpec.IsSatisfiedBy(new Customer { Email = null }); // false
Not Email
var spec = Specification.NotEmail();
spec.IsSatisfiedBy("john.doe@gmail.com"); // false
spec.IsSatisfiedBy("email.example.com"); // true
spec.IsSatisfiedBy(null); // true
As property
var customerSpec = Specification.NotEmail<Customer>(c => c.Email);
customerSpec.IsSatisfiedBy(new Customer { Email = "john.doe@gmail.com" }); // false
customerSpec.IsSatisfiedBy(new Customer { Email = "email.example.com" }); // true
customerSpec.IsSatisfiedBy(new Customer { Email = null }); // true
EF 6 support
Right now EmailSpecification
uses Regex
for verification - it is not supported in LinqToEntities (LinqToSql).