-
Notifications
You must be signed in to change notification settings - Fork 2
How to create Specification
marektihkan edited this page Sep 13, 2010
·
1 revision
- Create new class to
Core.(BoundedContext).Specifications
- Inherit this class from
Arc.Domain.Specifications.BaseSpecification<T>
- Add expression to Predicate in constructor
- Using Specification in query, it should be translatable to NHibernate criteria
namespace ExampleSolution.Core.Parties.Specifications
{
public class NameContainsSpecification : BaseSpecification<Person>
{
public NameContainsSpecification(string word)
{
BuildPredicateFrom(x => x.FullName.Contains(word));
}
}
}
var person = new Person("My", "Name");
var containsMyNameInPersonFullName = new NameContainsSpecification("My Name").IsSatisfiedBy(person);