protected SpecificationList <TEntity> NewSpecificationList(bool addCheckNullObject = true)
        {
            var result = new SpecificationList <TEntity>();

            if (addCheckNullObject)
            {
                ISpecificationValidation <TEntity> basicSpecification = new AndIsNotEmpty <TEntity, object>(c => c, AndIsNotEmptyType.Object, true, "Entity {0} can't be null", typeof(TEntity).Name);
                result.Add(basicSpecification, true);
            }

            return(result);
        }
Beispiel #2
0
 public static SpecificationList <TEntity> AndRegexValid <TEntity>(this SpecificationList <TEntity> specification, Func <TEntity, string> selector, string expression, Func <TEntity, bool> condition, bool stopIfInvalid, string message, params object[] args)
 {
     specification.Add(new AndIsValidRegex <TEntity>(selector, expression, condition, message, args), stopIfInvalid);
     return(specification);
 }
Beispiel #3
0
 public static SpecificationList <TEntity> AndIsNotEmpty <TEntity>(this SpecificationList <TEntity> specification, Func <TEntity, string> selector, Func <TEntity, bool> condition, bool stopIfInvalid, string message = "", params object[] args)
 {
     specification.Add(new AndIsNotEmpty <TEntity, string>(selector, AndIsNotEmptyType.String, condition, message, args), stopIfInvalid);
     return(specification);
 }
Beispiel #4
0
 public static SpecificationList <TEntity> AndMerge <TEntity>(this SpecificationList <TEntity> specification, SpecificationList <TEntity> specificationList, Func <TEntity, bool> condition, bool stopIfInvalid = false)
 {
     specification.Add(new AndMerge <TEntity>(specificationList, condition), stopIfInvalid);
     return(specification);
 }
 public static SpecificationList <TEntity> AndIsValidAsync <TEntity>(this SpecificationList <TEntity> specification, Func <TEntity, Task <bool> > selector, Func <TEntity, bool> condition, bool stopIfInvalid, string message = "", params object[] args)
 {
     specification.Add(new AndIsValidAsync <TEntity>(selector, condition, message, args), stopIfInvalid);
     return(specification);
 }
Beispiel #6
0
 public static SpecificationList <TEntity> Or <TEntity>(this SpecificationList <TEntity> specification, ISpecificationValidation <TEntity> spec1, ISpecificationValidation <TEntity> spec2, Func <TEntity, bool> condition, bool stopIfInvalid = false)
 {
     specification.Add(new Or <TEntity>(spec1, spec2, condition), stopIfInvalid);
     return(specification);
 }