public static bool IsSatisfiedBy <T>(this ISimpleSpecification <T> specification, T value)
        {
            var validator = specification.IsSatisfiedBy().Compile();

            return(validator.Invoke(value));
        }
Exemple #2
0
 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())));
 }
Exemple #4
0
 public IQueryable <TEntity> GetAllBySpecification(ISimpleSpecification <TEntity> specification)
 {
     return(GetAll().Where(specification.IsSatisfiedBy()));
 }