/// <summary>
        /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
        /// </summary>
        /// <param name="self">The instance.</param>
        /// <param name="otherProperty">The other property.</param>
        /// <param name="errorMessage">The error message.</param>
        /// <param name="passOnNull">Pass on null</param>
        /// <param name="errorMessageResourceType">Type of the error message resource.</param>
        /// <param name="errorMessageResourceName">Name of the error message resource.</param>
        /// <returns></returns>
        private static ModelMetadataItemBuilder <TValue> GreaterThanOrEqualTo <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, bool passOnNull, Func <string> errorMessage, Type errorMessageResourceType, string errorMessageResourceName)
        {
            self.AddAction(m =>
            {
                var validation = m.GetValidationOrCreateNew <GreaterThanOrEqualToAttributeMetadata>();

                validation.OtherProperty            = otherProperty;
                validation.PassOnNull               = passOnNull;
                validation.ErrorMessage             = errorMessage;
                validation.ErrorMessageResourceType = errorMessageResourceType;
                validation.ErrorMessageResourceName = errorMessageResourceName;
            });

            return(self);
        }
Ejemplo n.º 2
0
 public static ModelMetadataItemBuilder <string> MaximumLength([NotNull] this ModelMetadataItemBuilder <string> self, int length, string errorMessage)
 {
     return(MaximumLength(self, length, () => errorMessage));
 }
Ejemplo n.º 3
0
 public static ModelMetadataItemBuilder <string> MinimumLength([NotNull] this ModelMetadataItemBuilder <string> self, int length, Func <string> errorMessage)
 {
     return(MinimumLength(self, length, errorMessage, null, null));
 }
Ejemplo n.º 4
0
 public static ModelMetadataItemBuilder <string> AsMultilineText([NotNull] this ModelMetadataItemBuilder <string> self)
 {
     return(self.Template("MultilineText"));
 }
Ejemplo n.º 5
0
 public static ModelMetadataItemBuilder <string> Expression([NotNull] this ModelMetadataItemBuilder <string> self, string pattern, Func <string> errorMessage)
 {
     return(Expression(self, pattern, errorMessage, null, null));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="self">The instance.</param>
 /// <param name="otherProperty">The other property.</param>
 /// <param name="expression"></param>
 /// <param name="operator"></param>
 /// <param name="dependentValue"></param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> RegularExpressionIf <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, string expression, Operator @operator, object dependentValue)
 {
     return(RegularExpressionIf(self, otherProperty, expression, @operator, dependentValue, null, null, null));
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
        /// </summary>
        /// <param name="self">The instance.</param>
        /// <param name="otherProperty">The other property.</param>
        /// <param name="expression"></param>
        /// <param name="operator"></param>
        /// <param name="dependentValue"></param>
        /// <param name="errorMessage">The error message.</param>
        /// <param name="errorMessageResourceType">Type of the error message resource.</param>
        /// <param name="errorMessageResourceName">Name of the error message resource.</param>
        /// <returns></returns>
        private static ModelMetadataItemBuilder <TValue> RegularExpressionIf <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, string expression, Operator @operator, object dependentValue, Func <string> errorMessage, Type errorMessageResourceType, string errorMessageResourceName)
        {
            self.AddAction(m =>
            {
                var validation = m.GetValidationOrCreateNew <RegularExpressionIfAttributeMetadata>();

                validation.Expression               = expression;
                validation.OtherProperty            = otherProperty;
                validation.Operator                 = @operator;
                validation.DependentValue           = dependentValue;
                validation.ErrorMessage             = errorMessage;
                validation.ErrorMessageResourceType = errorMessageResourceType;
                validation.ErrorMessageResourceName = errorMessageResourceName;
            });

            return(self);
        }
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="self">The instance.</param>
 /// <param name="otherProperty">The other property.</param>
 /// <param name="expression"></param>
 /// <param name="errorMessageResourceType">Type of the error message resource.</param>
 /// <param name="errorMessageResourceName">Name of the error message resource.</param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> RequiredIfNotRegExMatch <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, string expression, Type errorMessageResourceType, string errorMessageResourceName)
 {
     return(RequiredIfNotRegExMatch(self, otherProperty, expression, null, errorMessageResourceType, errorMessageResourceName));
 }
        /// <summary>
        /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
        /// </summary>
        /// <param name="self">The instance.</param>
        /// <param name="otherProperty">The other property.</param>
        /// <param name="expression"></param>
        /// <param name="errorMessage">The error message.</param>
        /// <param name="errorMessageResourceType">Type of the error message resource.</param>
        /// <param name="errorMessageResourceName">Name of the error message resource.</param>
        /// <returns></returns>
        private static ModelMetadataItemBuilder <TValue> RequiredIfNotRegExMatch <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, string expression, Func <string> errorMessage, Type errorMessageResourceType, string errorMessageResourceName)
        {
            self.AddAction(m =>
            {
                var validation = m.GetValidationOrCreateNew <RequiredIfNotRegExMatchAttributeMetadata>();

                validation.OtherProperty            = otherProperty;
                validation.Expression               = expression;
                validation.ErrorMessage             = errorMessage;
                validation.ErrorMessageResourceType = errorMessageResourceType;
                validation.ErrorMessageResourceName = errorMessageResourceName;
            });

            return(self);
        }
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="otherProperty">The other property.</param>
 /// <param name="errorMessage">The error message.</param>
 /// <param name="passOnNull">Pass on null</param>
 /// <param name="self">The instance.</param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> EqualTo <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, bool passOnNull, string errorMessage)
 {
     return(EqualTo(self, otherProperty, passOnNull, () => errorMessage));
 }
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="self">The instance.</param>
 /// <param name="otherProperty">The other property.</param>
 /// <param name="expression"></param>
 /// <param name="errorMessage">The error message.</param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> RequiredIfNotRegExMatch <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, string expression, Func <string> errorMessage)
 {
     return(RequiredIfNotRegExMatch(self, otherProperty, expression, errorMessage, null, null));
 }
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="self">The instance.</param>
 /// <param name="otherProperty">The other property.</param>
 /// <param name="passOnNull">Pass on null</param>
 /// <param name="errorMessageResourceType">Type of the error message resource.</param>
 /// <param name="errorMessageResourceName">Name of the error message resource.</param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> EqualTo <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, bool passOnNull, Type errorMessageResourceType, string errorMessageResourceName)
 {
     return(EqualTo(self, otherProperty, passOnNull, null, errorMessageResourceType, errorMessageResourceName));
 }
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="otherProperty">The other property.</param>
 /// <param name="errorMessage">The error message.</param>
 /// <param name="self">The instance.</param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> GreaterThanOrEqualTo <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, string errorMessage)
 {
     return(GreaterThanOrEqualTo(self, otherProperty, false, errorMessage));
 }
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="self">The instance.</param>
 /// <param name="otherProperty">The other property.</param>
 /// <param name="passOnNull">Pass on null</param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> GreaterThanOrEqualTo <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, bool passOnNull)
 {
     return(GreaterThanOrEqualTo(self, otherProperty, passOnNull, null, null, null));
 }
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="otherProperty">The other property.</param>
 /// <param name="errorMessage">The error message.</param>
 /// <param name="passOnNull">Pass on null</param>
 /// <param name="self">The instance.</param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> NotEqualTo <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, bool passOnNull, Func <string> errorMessage)
 {
     return(NotEqualTo(self, otherProperty, passOnNull, errorMessage, null, null));
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="dependentValue"></param>
 /// <param name="errorMessage">The error message.</param>
 /// <param name="self">The instance.</param>
 /// <param name="otherProperty">The other property.</param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> RequiredIfNot <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, object dependentValue, Func <string> errorMessage)
 {
     return(RequiredIfNot(self, otherProperty, dependentValue, errorMessage, null, null));
 }
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="self">The instance.</param>
 /// <param name="otherProperty">The other property.</param>
 /// <param name="errorMessageResourceType">Type of the error message resource.</param>
 /// <param name="errorMessageResourceName">Name of the error message resource.</param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> NotEqualTo <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, Type errorMessageResourceType, string errorMessageResourceName)
 {
     return(NotEqualTo(self, otherProperty, false, null, errorMessageResourceType, errorMessageResourceName));
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="self">The instance.</param>
 /// <param name="otherProperty">The other property.</param>
 /// <param name="dependentValue"></param>
 /// <param name="errorMessageResourceType">Type of the error message resource.</param>
 /// <param name="errorMessageResourceName">Name of the error message resource.</param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> RequiredIfNot <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, object dependentValue, Type errorMessageResourceType, string errorMessageResourceName)
 {
     return(RequiredIfNot(self, otherProperty, dependentValue, null, errorMessageResourceType, errorMessageResourceName));
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="self">The instance.</param>
 /// <param name="otherProperty">The other property.</param>
 /// <param name="dependentValue"></param>
 /// <param name="errorMessageResourceType">Type of the error message resource.</param>
 /// <param name="errorMessageResourceName">Name of the error message resource.</param>
 /// <param name="expression"></param>
 /// <param name="operator"></param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> RegularExpressionIf <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, string expression, Operator @operator, object dependentValue, Type errorMessageResourceType, string errorMessageResourceName)
 {
     return(RegularExpressionIf(self, otherProperty, expression, @operator, dependentValue, null, errorMessageResourceType, errorMessageResourceName));
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="self">The instance.</param>
 /// <param name="otherProperty">The other property.</param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> RequiredIfFalse <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty)
 {
     return(RequiredIfFalse(self, otherProperty, null, null, null));
 }
Ejemplo n.º 21
0
 public static ModelMetadataItemBuilder <string> AsHtml([NotNull] this ModelMetadataItemBuilder <string> self)
 {
     return(self.Template("Html"));
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="otherProperty">The other property.</param>
 /// <param name="errorMessage">The error message.</param>
 /// <param name="self">The instance.</param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> RequiredIfFalse <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, Func <string> errorMessage)
 {
     return(RequiredIfFalse(self, otherProperty, errorMessage, null, null));
 }
Ejemplo n.º 23
0
 public static ModelMetadataItemBuilder <string> AsPassword([NotNull] this ModelMetadataItemBuilder <string> self)
 {
     return(self.Template("Password"));
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="self">The instance.</param>
 /// <param name="otherProperty">The other property.</param>
 /// <param name="errorMessageResourceType">Type of the error message resource.</param>
 /// <param name="errorMessageResourceName">Name of the error message resource.</param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> RequiredIfFalse <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, Type errorMessageResourceType, string errorMessageResourceName)
 {
     return(RequiredIfFalse(self, otherProperty, null, errorMessageResourceType, errorMessageResourceName));
 }
Ejemplo n.º 25
0
 public static ModelMetadataItemBuilder <string> Expression([NotNull] this ModelMetadataItemBuilder <string> self, string pattern, Type errorMessageResourceType, string errorMessageResourceName)
 {
     return(Expression(self, pattern, null, errorMessageResourceType, errorMessageResourceName));
 }
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="self">The instance.</param>
 /// <param name="otherProperty">The other property.</param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> NotEqualTo <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty)
 {
     return(NotEqualTo(self, otherProperty, false));
 }
Ejemplo n.º 27
0
 public static ModelMetadataItemBuilder <string> MinimumLength([NotNull] this ModelMetadataItemBuilder <string> self, int length)
 {
     return(MinimumLength(self, length, null, null, null));
 }
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="otherProperty">The other property.</param>
 /// <param name="errorMessage">The error message.</param>
 /// <param name="self">The instance.</param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> NotEqualTo <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, Func <string> errorMessage)
 {
     return(NotEqualTo(self, otherProperty, false, errorMessage));
 }
Ejemplo n.º 29
0
 public static ModelMetadataItemBuilder <string> MinimumLength([NotNull] this ModelMetadataItemBuilder <string> self, int length, Type errorMessageResourceType, string errorMessageResourceName)
 {
     return(MinimumLength(self, length, null, errorMessageResourceType, errorMessageResourceName));
 }
 /// <summary>
 /// Sets the range of value, this comes into action when is <code>Required</code> is <code>true</code>.
 /// </summary>
 /// <param name="otherProperty">The other property.</param>
 /// <param name="errorMessage">The error message.</param>
 /// <param name="self">The instance.</param>
 /// <returns></returns>
 public static ModelMetadataItemBuilder <TValue> RequiredIfNotEmpty <TValue>(this ModelMetadataItemBuilder <TValue> self, string otherProperty, string errorMessage)
 {
     return(RequiredIfNotEmpty(self, otherProperty, () => errorMessage));
 }