/// <summary>
 /// Required DateTime <br />
 /// DateTime 值需要满足
 /// </summary>
 /// <param name="registrar"></param>
 /// <param name="style"></param>
 /// <typeparam name="T"></typeparam>
 /// <typeparam name="TVal"></typeparam>
 /// <returns></returns>
 public static IPredicateValidationRegistrar <T, TVal> RequiredDateTime <T, TVal>(this IValueFluentValidationRegistrar <T, TVal> registrar, DateTimeStyles style = DateTimeStyles.None)
 {
     registrar._impl().ExposeValueRuleBuilder2().RequiredDateTime(style);
     return((IPredicateValidationRegistrar <T, TVal>)registrar);
 }
 /// <summary>
 /// Required Guid <br />
 /// GUID 值需要满足
 /// </summary>
 /// <param name="registrar"></param>
 /// <typeparam name="T"></typeparam>
 /// <typeparam name="TVal"></typeparam>
 /// <returns></returns>
 public static IPredicateValidationRegistrar <T, TVal> RequiredGuid <T, TVal>(this IValueFluentValidationRegistrar <T, TVal> registrar)
 {
     registrar._impl().ExposeValueRuleBuilder2().RequiredGuid();
     return((IPredicateValidationRegistrar <T, TVal>)registrar);
 }
 /// <summary>
 /// Not empty <br />
 /// 应不为空
 /// </summary>
 /// <param name="registrar"></param>
 /// <returns></returns>
 public static IPredicateValidationRegistrar NotEmpty(this IValueFluentValidationRegistrar registrar)
 {
     registrar._impl().ExposeValueRuleBuilder().NotEmpty();
     return((IPredicateValidationRegistrar)registrar);
 }
 /// <summary>
 /// Required Numeric <br />
 /// 数字需要满足
 /// </summary>
 /// <param name="registrar"></param>
 /// <param name="isOptions"></param>
 /// <typeparam name="T"></typeparam>
 /// <typeparam name="TVal"></typeparam>
 /// <returns></returns>
 public static IPredicateValidationRegistrar <T, TVal> RequiredNumeric <T, TVal>(this IValueFluentValidationRegistrar <T, TVal> registrar, TypeIsOptions isOptions = TypeIsOptions.Default)
 {
     registrar._impl().ExposeValueRuleBuilder2().RequiredNumeric(isOptions);
     return((IPredicateValidationRegistrar <T, TVal>)registrar);
 }
 /// <summary>
 /// Required Boolean <br />
 /// 布尔值需要满足
 /// </summary>
 /// <param name="registrar"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static IPredicateValidationRegistrar <T> RequiredBoolean <T>(this IValueFluentValidationRegistrar <T> registrar)
 {
     registrar._impl().ExposeValueRuleBuilder().RequiredBoolean();
     return((IPredicateValidationRegistrar <T>)registrar);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Max length <br />
 /// 至多长
 /// </summary>
 /// <param name="registrar"></param>
 /// <param name="max"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static IPredicateValidationRegistrar <T> MaxLength <T>(this IValueFluentValidationRegistrar <T> registrar, int max)
 {
     registrar._impl().ExposeValueRuleBuilder().MaxLength(max);
     return((IPredicateValidationRegistrar <T>)registrar);
 }
 /// <summary>
 /// Required String <br />
 /// 字符串需要满足
 /// </summary>
 /// <param name="registrar"></param>
 /// <returns></returns>
 public static IPredicateValidationRegistrar RequiredString(this IValueFluentValidationRegistrar registrar)
 {
     registrar._impl().ExposeValueRuleBuilder().RequiredString();
     return((IPredicateValidationRegistrar)registrar);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Min length <br />
 /// 至少长
 /// </summary>
 /// <param name="registrar"></param>
 /// <param name="min"></param>
 /// <returns></returns>
 public static IPredicateValidationRegistrar MinLength(this IValueFluentValidationRegistrar registrar, int min)
 {
     registrar._impl().ExposeValueRuleBuilder().MinLength(min);
     return((IPredicateValidationRegistrar)registrar);
 }
Exemplo n.º 9
0
 /// <summary>
 /// As least <br />
 /// 至少存在
 /// </summary>
 /// <param name="registrar"></param>
 /// <param name="count"></param>
 /// <returns></returns>
 public static IPredicateValidationRegistrar AtLeast(this IValueFluentValidationRegistrar registrar, int count)
 {
     registrar._impl().ExposeValueRuleBuilder().AtLeast(count);
     return((IPredicateValidationRegistrar)registrar);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Length <br />
 /// 应长
 /// </summary>
 /// <param name="registrar"></param>
 /// <param name="min"></param>
 /// <param name="max"></param>
 /// <typeparam name="T"></typeparam>
 /// <typeparam name="TVal"></typeparam>
 /// <returns></returns>
 public static IPredicateValidationRegistrar <T, TVal> Length <T, TVal>(this IValueFluentValidationRegistrar <T, TVal> registrar, int min, int max)
 {
     registrar._impl().ExposeValueRuleBuilder2().Length(min, max);
     return((IPredicateValidationRegistrar <T, TVal>)registrar);
 }
Exemplo n.º 11
0
        /// <summary>
        /// Register for Sink Validator for FluentValidation
        /// </summary>
        /// <param name="registrar"></param>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="TValidator"></typeparam>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException"></exception>
        public static IFluentValidationRegistrar AndForFluentValidator <T, TValidator>(this IValueFluentValidationRegistrar <T> registrar)
            where TValidator : class, FluentValidation.IValidator, new()
        {
            if (registrar is null)
            {
                throw new ArgumentNullException(nameof(registrar));
            }

            return(registrar.AndForCustomValidator <FluentValidator <TValidator> >());
        }
 /// <summary>
 /// Range... [from .. to ..] <br />
 /// 位于闭区间
 /// </summary>
 /// <param name="registrar"></param>
 /// <param name="from"></param>
 /// <param name="to"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static IPredicateValidationRegistrar <T> RangeWithCloseInterval <T>(this IValueFluentValidationRegistrar <T> registrar, object from, object to)
 {
     registrar._impl().ExposeValueRuleBuilder().RangeWithCloseInterval(from, to);
     return((IPredicateValidationRegistrar <T>)registrar);
 }
 /// <summary>
 /// Range... from .. to .. <br />
 /// 位于区间
 /// </summary>
 /// <param name="registrar"></param>
 /// <param name="from"></param>
 /// <param name="to"></param>
 /// <param name="options"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static IPredicateValidationRegistrar <T> Range <T>(this IValueFluentValidationRegistrar <T> registrar, object from, object to, RangeOptions options = RangeOptions.OpenInterval)
 {
     registrar._impl().ExposeValueRuleBuilder().Range(from, to, options);
     return((IPredicateValidationRegistrar <T>)registrar);
 }
 /// <summary>
 /// Range... [from .. to ..] <br />
 /// 位于闭区间
 /// </summary>
 /// <param name="registrar"></param>
 /// <param name="from"></param>
 /// <param name="to"></param>
 /// <typeparam name="T"></typeparam>
 /// <typeparam name="TVal"></typeparam>
 /// <returns></returns>
 public static IPredicateValidationRegistrar <T, TVal> RangeWithCloseInterval <T, TVal>(this IValueFluentValidationRegistrar <T, TVal> registrar, TVal from, TVal to)
 {
     registrar._impl().ExposeValueRuleBuilder2().RangeWithCloseInterval(from, to);
     return((IPredicateValidationRegistrar <T, TVal>)registrar);
 }