public StringFormatRule(string rootType, string property, Func<string> formatDescription, Func<Regex> formatExpression, Func<string> reformatExpression = null, RuleInvocationType invocationTypes = RuleInvocationType.PropertyChanged) : base(rootType, property, CreateError(property, formatDescription), invocationTypes, property) { this.formatDescription = formatDescription; this.formatExpression = formatExpression; this.reformatExpression = reformatExpression; }
public RequiredIfRule(string rootType, string property, string compareSource, CompareOperator compareOperator, object compareValue, RuleInvocationType invocationTypes, Error error) : base(rootType, property, error, invocationTypes) { this.CompareSource = compareSource; this.CompareOperator = compareOperator; this.CompareValue = compareValue; InitializePredicates(compareSource); }
/// <summary> /// Creates a new instance of <see cref="CompareRule"/> for the specified property. /// </summary> /// <param name="rootType"></param> /// <param name="property"></param> /// <param name="conditionType"></param> /// <param name="comparePath"></param> /// <param name="compareOperator"></param> /// <param name="error"></param> /// <param name="invocationTypes"></param> public CompareRule(string rootType, string property, string compareSource, CompareOperator compareOperator, Error error, RuleInvocationType invocationTypes) : base(rootType, property, error, invocationTypes) { this.CompareSource = compareSource; this.CompareOperator = compareOperator; InitializePredicates(compareSource); ValidateRuleCriteria(); }
public RequiredIfRule(string rootType, string property, string compareSource, CompareOperator compareOperator, object compareValue, RuleInvocationType invocationTypes, params ConditionTypeSet[] sets) : base(rootType, property, CreateError(property, compareSource, compareOperator, compareValue, sets), invocationTypes) { this.CompareSource = compareSource; this.CompareOperator = compareOperator; this.CompareValue = compareValue; InitializePredicates(compareSource); }
/// <summary> /// Creates a new rule instance. /// </summary> /// <param name="rootType">The root <see cref="ModelType"/> the rule is for</param> /// <param name="name"></param> /// <param name="invocationTypes"></param> /// <param name="predicates"></param> public Rule(string rootType, string name, RuleInvocationType invocationTypes, ConditionType[] conditionTypes, params string[] predicates) { this.rootTypeName = rootType; this.Name = name; this.InvocationTypes = invocationTypes; this.ConditionTypes = conditionTypes ?? new ConditionType[0]; // Default the execution location to server this.ExecutionLocation = RuleExecutionLocation.Server; // Split the predicates into property change paths and return values if (predicates != null && predicates.Length > 0) { SetPredicates(predicates); } }
/// <summary> /// Creates a new <see cref="PropertyRule"/> for the specified property and condition type. /// </summary> /// <param name="rootType"></param> /// <param name="property"></param> /// <param name="conditionType"></param> /// <param name="invocationTypes"></param> /// <param name="predicates"></param> public PropertyRule(string rootType, string property, Func<ModelType, ConditionType> conditionType, RuleInvocationType invocationTypes, params string[] predicates) : base(rootType, rootType + "." + property, invocationTypes, predicates) { this.property = property; this.ExecutionLocation = RuleExecutionLocation.ServerAndClient; if (conditionType != null) Initialize += (s, e) => { // Make sure the condition type and rule have a unique name var type = RootType; var error = conditionType(type); var originalCode = error.Code; var uniqueCode = originalCode; int count = 1; while (ConditionType.GetConditionTypes(type).Any(ct => ct.Code == uniqueCode)) uniqueCode = originalCode + count++; error.Code = uniqueCode; Name = uniqueCode; // Assign the condition type to the rule ConditionTypes = new ConditionType[] { error }; }; }
public RequiredIfRule(string rootType, string property, string compareSource, CompareOperator compareOperator, object compareValue, RuleInvocationType invocationTypes, object requiredValue, params ConditionTypeSet[] sets) : this(rootType, property, compareSource, compareOperator, compareValue, invocationTypes, sets) { RequiredValue = requiredValue; }
public ListLengthRule(string rootType, string property, int minimum, int maximum, Error error, RuleInvocationType invocationTypes) : base(rootType, property, error, invocationTypes, property) { this.Minimum = minimum; this.Maximum = maximum; }
public AllowedValuesRule(string rootType, string property, LambdaExpression source, Error error, RuleInvocationType invocationTypes, bool ignoreValidation = false) : base(rootType, property, error, invocationTypes) { this.IgnoreValidation = ignoreValidation; InitializeSource(null, source); }
public StringFormatRule(string rootType, string property, Error error, Func <Regex> formatExpression, Func <string> reformatExpression = null, RuleInvocationType invocationTypes = RuleInvocationType.PropertyChanged) : base(rootType, property, error, invocationTypes, property) { this.formatExpression = formatExpression; this.reformatExpression = reformatExpression; }
public ListLengthRule(string rootType, string property, int minimum, int maximum, RuleInvocationType invocationTypes) : base(rootType, property, CreateError(property, minimum, maximum), invocationTypes, property) { this.Minimum = minimum; this.Maximum = maximum; }
public RequiredRule(string rootType, string property, RuleInvocationType invocationTypes, Error error) : base(rootType, property, error, invocationTypes, property) { }
public OwnerRule(string rootType, string property, RuleInvocationType invocationTypes) : base(rootType, property, (Func<ModelType, ConditionType>)null, invocationTypes, property) { }
protected PropertyRule(string rootType, string property, RuleInvocationType invocationTypes, params string[] predicates) : base(rootType, property, predicates) { this.property = property; this.ExecutionLocation = RuleExecutionLocation.ServerAndClient; }
/// <summary> /// Creates a new <see cref="PropertyRule"/> for the specified property and condition type. /// </summary> /// <param name="rootType"></param> /// <param name="property"></param> /// <param name="conditionType"></param> /// <param name="invocationTypes"></param> /// <param name="predicates"></param> public PropertyRule(string rootType, string property, ConditionType conditionType, RuleInvocationType invocationTypes, params string[] predicates) : base(rootType, conditionType.Code, invocationTypes, new ConditionType[] { conditionType }, predicates) { this.property = property; this.ExecutionLocation = RuleExecutionLocation.ServerAndClient; }
public RequiredIfRule(string rootType, string property, string compareSource, CompareOperator compareOperator, object compareValue, RuleInvocationType invocationTypes, Error error, object requiredValue) : this(rootType, property, compareSource, compareOperator, compareValue, invocationTypes, error) { RequiredValue = requiredValue; }
public OwnerRule(string rootType, string property, RuleInvocationType invocationTypes) : base(rootType, property, (Func <ModelType, ConditionType>)null, invocationTypes, property) { }
/// <summary> /// Creates a new rule instance. /// </summary> /// <param name="rootType">The root <see cref="ModelType"/> the rule is for</param> /// <param name="name"></param> /// <param name="invocationTypes"></param> /// <param name="predicates"></param> public Rule(string rootType, string name, RuleInvocationType invocationTypes, params string[] predicates) : this(rootType, name, invocationTypes, null, predicates) { }
public RequiredRule(string rootType, string property, RuleInvocationType invocationTypes, string errorMessage, object requiredValue, params ConditionTypeSet[] sets) : this(rootType, property, invocationTypes, new Error(GetErrorCode(rootType, property, "Required"), errorMessage, sets)) { RequiredValue = requiredValue; }
public RequiredRule(string rootType, string property, RuleInvocationType invocationTypes, Error error, object requiredValue) : base(rootType, property, error, invocationTypes, property) { RequiredValue = requiredValue; }
/// <summary> /// Creates a new <see cref="PropertyRule"/> for the specified property and condition type. /// </summary> /// <param name="rootType"></param> /// <param name="property"></param> /// <param name="conditionType"></param> /// <param name="invocationTypes"></param> /// <param name="predicates"></param> public PropertyRule(string rootType, string property, Func <ModelType, ConditionType> conditionType, RuleInvocationType invocationTypes, params string[] predicates) : base(rootType, rootType + "." + property, invocationTypes, predicates) { this.property = property; this.ExecutionLocation = RuleExecutionLocation.ServerAndClient; if (conditionType != null) { Initialize += (s, e) => { // Make sure the condition type and rule have a unique name var type = RootType; var error = conditionType(type); var originalCode = error.Code; var uniqueCode = originalCode; int count = 1; while (ConditionType.GetConditionTypes(type).Any(ct => ct.Code == uniqueCode)) { uniqueCode = originalCode + count++; } error.Code = uniqueCode; Name = uniqueCode; // Assign the condition type to the rule ConditionTypes = new ConditionType[] { error }; } } ; }
public AllowedValuesRule(string rootType, string property, string source, RuleInvocationType invocationTypes, bool ignoreValidation = false) : base(rootType, property, CreateError(property), invocationTypes) { this.IgnoreValidation = ignoreValidation; InitializeSource(source, null); }
public RequiredRule(string rootType, string property, RuleInvocationType invocationTypes, object requiredValue, params ConditionTypeSet[] sets) : base(rootType, property, CreateError(property, sets), invocationTypes, property) { RequiredValue = requiredValue; }
public RangeRule(string rootType, string property, IComparable minimum, IComparable maximum, Error error, RuleInvocationType invocationTypes) : base(rootType, property, error, invocationTypes, property) { SetRange(minimum, maximum); }