当前位置: 首页>>代码示例>>C#>>正文


C# IValidator.Validate方法代码示例

本文整理汇总了C#中IValidator.Validate方法的典型用法代码示例。如果您正苦于以下问题:C# IValidator.Validate方法的具体用法?C# IValidator.Validate怎么用?C# IValidator.Validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IValidator的用法示例。


在下文中一共展示了IValidator.Validate方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ValidateFormat

 private static void ValidateFormat(List<char> delimiters, string numbers, IValidator validator)
 {
     if (!validator.Validate(numbers, delimiters))
     {
         throw new CalculatorFormatException(validator.LastErrorMessage);
     }
 }
开发者ID:jasosa,项目名称:StringCalculator,代码行数:7,代码来源:Calculator.cs

示例2: ValidationTemplate

 public ValidationTemplate(INotifyPropertyChanged target)
 {
     this.target = target;
     validator = GetValidator(target.GetType());
     validationResult = validator.Validate(target);
     target.PropertyChanged += Validate;
 }
开发者ID:Fody,项目名称:Validar,代码行数:7,代码来源:ValidationTemplate.cs

示例3: Validate

 public static void Validate(IValidator validator, object entity)
 {
     var result = validator.Validate(entity);
     if (result.Errors.Count > 0)
     {
         throw new ValidationException(result.Errors);
     }
 }
开发者ID:Robooto,项目名称:NorthwindProject,代码行数:8,代码来源:FluentValidatorTool.cs

示例4: IsValid

        /// <summary>
        /// Check to see if the current validation chain is valid.
        /// </summary>
        /// <returns>true if valid, otherwise false</returns>
        public bool IsValid(ImportData readBundle, IValidator validator)
        {
            var valid = true;

            foreach (Row row in readBundle.rows) {
                validator.Validate(row);

                if (!row.valid) {
                    valid = false;
                }
            }

            return valid;
        }
开发者ID:apsdsm,项目名称:datahelpers,代码行数:18,代码来源:ValidationRunner.cs

示例5: ModelBase

 public ModelBase()
 {
     validator = ValidationFactory.GetValidator(GetType());
     validationResult = validator.Validate(this);
 }
开发者ID:marcuswhit,项目名称:NotifyPropertyWeaver,代码行数:5,代码来源:ModelBase.cs

示例6: PerformValidation

 protected virtual void PerformValidation(object instance, IValidator validator, ModelBindingContext context)
 {
     string modelName = WasFallbackPerformed(context) ? string.Empty : context.ModelName;
     var result = validator.Validate(instance);
     result.AddToModelState(context.ModelState, modelName);
 }
开发者ID:robashton,项目名称:FluentValidation,代码行数:6,代码来源:FluentValidationModelBinderDecorator.cs

示例7: ValidateAndCollect

 /// <summary>
 /// Validates the rule and returns a boolMessage.
 /// </summary>
 /// <param name="rule"></param>
 /// <returns></returns>
 public static bool ValidateAndCollect(IValidator validator, IValidationResults results)
 {
     IValidationResults validationResults = validator.Validate(results);
     return validationResults.IsValid;
 }
开发者ID:aldwen,项目名称:Weather-SDK,代码行数:10,代码来源:ValidationUtils.cs

示例8: Validate

        /// <summary>
        /// Validates the rule and returns a boolMessage.
        /// </summary>
        /// <param name="rule"></param>
        /// <returns></returns>
        public static BoolMessage Validate(IValidator validator)
        {
            IValidationResults results = validator.Validate() as IValidationResults;

            // Empty message if Successful.
            if (results.IsValid) return new BoolMessage(true, string.Empty);

            // Error
            string multiLineError = results.Message();
            return new BoolMessage(false, multiLineError);
        }
开发者ID:aldwen,项目名称:Weather-SDK,代码行数:16,代码来源:ValidationUtils.cs

示例9: ValidatePart

		void ValidatePart(JudoEntry entry, IValidator validator, CardPart cardPart)
		{
			var validationResponse = validator.Validate(entry.Text, _currentDiscoveredNetwork, _acceptedCardNetworks);
			ChangeValidParts(cardPart, validationResponse.IsValid);
			entry.Error = !validationResponse.IsValid && validationResponse.ShouldDisplayErrorMessage ? validationResponse.ErrorMessage : null;
		}
开发者ID:JudoPay,项目名称:Judo-Xamarin,代码行数:6,代码来源:CardEntryPage.xaml.cs

示例10: Validate

 public static void Validate(IValidator validator, object entityToValidate)
 {
     var result = validator.Validate(entityToValidate);
     throw new ValidationException(result.Errors);
 }
开发者ID:ItsDubC,项目名称:NorthwindProject,代码行数:5,代码来源:FluentValidatorTool.cs

示例11: RunValidation

 public List<Error> RunValidation(IValidator validator, Resource resource)
 {
     return validator.Validate(resource);
 }
开发者ID:PaulCampbell,项目名称:ATP,代码行数:4,代码来源:ValidationRunner.cs


注:本文中的IValidator.Validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。