Пример #1
0
        /// <summary>
        ///   Specifies validation part with object predicate without value. Use with closures in conditions
        /// </summary>
        public static IValidationCondition When(
            this IValidationContext validationContext,
            string validationPart)
        {
            var validationKey = validationContext.CombineValidationPath(validationPart);

            return(new ValidationCondition(
                       validationContext,
                       validationKey));
        }
Пример #2
0
        /// <summary>
        ///   Specifies validation part with provider of <see cref="TValue" /> value
        /// </summary>
        public static IValidationCondition <TValue> When <TValue>(
            this IValidationContext validationContext,
            string validationPart,
            Lazy <TValue> value)
        {
            var validationKey = validationContext.CombineValidationPath(validationPart);

            return(new ValidationCondition <TValue>(
                       validationContext,
                       validationKey,
                       value));
        }
Пример #3
0
        /// <summary>
        ///   Creates new validation scope with specified validation path
        /// </summary>
        public static IValidationScope CreateScope(
            this IValidationContext validationContext,
            string validationPart,
            ValidationSeverity?validationSeverity = null)
        {
            var validationPath = validationContext.CombineValidationPath(validationPart);

            return(new ValidationScope(
                       validationContext,
                       validationPath,
                       validationSeverity));
        }