Feature | Is supported |
---|---|
Null safe | |
Validation | |
EF Core | |
EF 6 |
Validation result
Error
"Object is not null".
"Object is null" - for negation.
Info
Checks if candidate is null.
Usage
var spec = Specification.Null<string>();
spec.IsSatisfiedBy(null); // true
spec.IsSatisfiedBy(""); // false
As property
var customerSpec = Specification.Null<Customer, string>(c => c.Comments);
customerSpec.IsSatisfiedBy(new Customer { Comments = null }); // true
customerSpec.IsSatisfiedBy(new Customer { Comments = "VIP" }); // false
Not Null
var spec = Specification.NotNull<string>();
spec.IsSatisfiedBy(null); // false
spec.IsSatisfiedBy(""); // true
As property
var customerSpec = Specification.NotNull<Customer, string>(c => c.Comments);
customerSpec.IsSatisfiedBy(new Customer { Comments = null }); // false
customerSpec.IsSatisfiedBy(new Customer { Comments = "VIP" }); // true
EF 6 support
Normally NullSpecification<T>
is fully supported in EF 6. But be aware, that different types of candidates can raise exceptions.
Only entity types and primitive types are comparable.