public static IPropertyRuleBuilder<T, TProperty> IsNotEqual<T, TProperty>( this IPropertyRuleBuilder<T, TProperty> ruleBuilder, double compareValue, double comparisonTolerance) where T : class { var validationStep = new FloatEqualPropertyValidationStep<T, TProperty>(compareValue, comparisonTolerance, false); ruleBuilder.AddValidationStep(validationStep); return ruleBuilder; }
public static IPropertyRuleBuilder<T, TProperty> HasMaximumLength<T, TProperty>( this IPropertyRuleBuilder<T, TProperty> ruleBuilder, int length) where T : class { var validationStep = new HasMaximumLengthPropertyValidationStep<T, TProperty>(length); ruleBuilder.AddValidationStep(validationStep); return ruleBuilder; }
public static IPropertyRuleBuilder<T, TProperty> IsEqual<T, TProperty>( this IPropertyRuleBuilder<T, TProperty> ruleBuilder, double compareValue) where T : class { var validationStep = new FloatEqualPropertyValidationStep<T, TProperty>(compareValue, 0.0001, true); ruleBuilder.AddValidationStep(validationStep); return ruleBuilder; }
public static IPropertyRuleBuilder<T, TProperty> HasLength<T, TProperty>( this IPropertyRuleBuilder<T, TProperty> ruleBuilder, int minLength, int maxLength) where T : class { var validationStep = new HasLengthBetweenPropertyValidationStep<T, TProperty>(minLength, maxLength); ruleBuilder.AddValidationStep(validationStep); return ruleBuilder; }
public static IPropertyRuleBuilder<T, TProperty> HasLength<T, TProperty>( this IPropertyRuleBuilder<T, TProperty> ruleBuilder, Func<T, TProperty, int> checkLength) where T : class { var validationStep = new CheckLengthPropertyValidationStep<T, TProperty>(checkLength); ruleBuilder.AddValidationStep(validationStep); return ruleBuilder; }
public static IPropertyRuleBuilder<T, TProperty> EndsWith<T, TProperty>( this IPropertyRuleBuilder<T, TProperty> ruleBuilder, string text) where T : class { var validationStep = new EndsWithPropertyValidationStep<T, TProperty>(text); ruleBuilder.AddValidationStep(validationStep); return ruleBuilder; }
public static IPropertyRuleBuilder<T, TProperty> Between<T, TProperty>( this IPropertyRuleBuilder<T, TProperty> ruleBuilder, TProperty lowerEnd, TProperty upperEnd) where T : class { var validationStep = new BetweenPropertyValidationStep<T, TProperty>(lowerEnd, upperEnd); ruleBuilder.AddValidationStep(validationStep); return ruleBuilder; }
public static IPropertyRuleBuilder<T, TProperty> IsNotEqual<T, TProperty>( this IPropertyRuleBuilder<T, TProperty> ruleBuilder, TProperty compareValue) where T : class { var validationStep = new EqualPropertyValidationStep<T, TProperty>(compareValue, false); ruleBuilder.AddValidationStep(validationStep); return ruleBuilder; }
public static IPropertyRuleBuilder<T, TProperty> Must<T, TProperty>( this IPropertyRuleBuilder<T, TProperty> ruleBuilder, Func<T, TProperty, bool> validate) where T : class { Ensure.IsNotNull(validate, nameof(validate)); var validationStep = new ExtendedDelegatePropertyValidationStep<T, TProperty>(validate); ruleBuilder.AddValidationStep(validationStep); return ruleBuilder; }
public static IPropertyRuleBuilder<T, TProperty> IsFalse<T, TProperty>( this IPropertyRuleBuilder<T, TProperty> ruleBuilder, Func<TProperty, bool> isFalse) where T : class { Ensure.IsNotNull(isFalse, nameof(isFalse)); var validationStep = new DelegatePropertyValidationStep<T, TProperty>(property => !isFalse(property)); ruleBuilder.AddValidationStep(validationStep); return ruleBuilder; }