public static bool IsSatisfiedBy <T>(this ISimpleSpecification <T> specification, T value) { var validator = specification.IsSatisfiedBy().Compile(); return(validator.Invoke(value)); }
public virtual TEntity GetBySpecification(ISimpleSpecification <TEntity> specification) { return(GetAll().Where(specification.IsSatisfiedBy()).SingleOrDefault()); }
public static ISimpleSpecification <T> And <T>(this ISimpleSpecification <T> spec1, ISimpleSpecification <T> spec2) { return(new CombineSpecification <T>(spec1.IsSatisfiedBy().And(spec2.IsSatisfiedBy()))); }
public IQueryable <TEntity> GetAllBySpecification(ISimpleSpecification <TEntity> specification) { return(GetAll().Where(specification.IsSatisfiedBy())); }