• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IValidator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



IValidator类属于命名空间,在下文中一共展示了IValidator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: TestsViewModel

        public TestsViewModel(
            ITestQuery queries,
            ITests commands,
            ISubjectQuery subjectQuery,
            IValidator<Test> testValidator,
            IValidator<Question> questionValidator,
            IValidator<Answer> answerValidator,
            IValidator<AssociatedSubject> subjectValidator
        )
            : base()
        {
            _queries = queries;
            _commands = commands;

            _subjectQuery = subjectQuery;

            _testValidator = testValidator;
            _questionValidator = questionValidator;
            _answerValidator = answerValidator;
            _subjectValidator = subjectValidator;


            LoadAllTests();

            _addTestCommand = new RelayCommand(
                () => AddNewTest(),
                () => CanAddNewTest()
            );
        }
开发者ID:LukeForder,项目名称:TestIt,代码行数:29,代码来源:TestsViewModel.cs


示例3: GetValidatorsForModel

 IEnumerable<ModelValidator> GetValidatorsForModel(ModelMetadata metadata, ControllerContext context,IValidator validator)
 {
     if (validator != null)
     {
         yield return new FVModelValidator(metadata, context, validator);
     }
 }
开发者ID:nicholaspei,项目名称:DevText,代码行数:7,代码来源:FVModelValidatorProvider.cs


示例4: GenerateForValidator

        void GenerateForValidator(IValidator inputValidator, TypeMetaData metaData, string parentKey, bool isParentConcept = false, bool isParentModelRule = false)
        {
            var inputValidatorType = inputValidator.GetType();
            var genericArguments = inputValidatorType.BaseType.GetGenericArguments();

            var descriptor = inputValidator.CreateDescriptor();
            var members = descriptor.GetMembersWithValidators();
            
            foreach (var member in members)
            {
                var rules = descriptor.GetRulesForMember(member.Key);
                foreach (var rule in rules)
                {
                    foreach (var validator in rule.Validators)
                    {
                        var isModelRule = member.Key == ModelRule<string>.ModelRulePropertyName;
                        var currentKey = GetKeyForMember(parentKey, isParentConcept, isParentModelRule, member, isModelRule);

                        if (validator is ChildValidatorAdaptor)
                        {
                            GenerateForChildValidator(metaData, genericArguments, member, validator, isModelRule, currentKey);
                        }
                        else if (validator is IPropertyValidator)
                        {
                            GenerateFor(metaData, currentKey, validator);
                        }
                    }
                }
            }
        }
开发者ID:dolittle,项目名称:Bifrost,代码行数:30,代码来源:ValidationMetaDataGenerator.cs


示例5: CardService

 public CardService(ICardRepository cardRepository, IValidator validator, IProjectService projectService, ISession session)
 {
     _cardRepository = cardRepository;
     _validator = validator;
     _projectService = projectService;
     _session = session;
 }
开发者ID:rauhryan,项目名称:kokugen,代码行数:7,代码来源:ICardService.cs


示例6: GetCompositeResultsPrivate

 private static IValidationResultCollection GetCompositeResultsPrivate(IResourceManager mgr, string rule, IValidator[] validators)
 {
     ValidationResultCollection results = new ValidationResultCollection(mgr, rule);
     foreach (IValidator validator in validators)
         results.Add(validator.Validate());
     return results;
 }
开发者ID:ddaysoftware,项目名称:icalvalid,代码行数:7,代码来源:ValidationResult.cs


示例7: DoEmit

 /// <summary>
 /// Emit implementation starting point
 /// </summary>
 /// <param name="v">The v.</param>
 /// <param name="sb">The sb.</param>
 /// <returns></returns>
 protected StringBuilder DoEmit(IValidator v, StringBuilder sb)
 {
     if (v.GetType().IsGenericType && typeof(ValidationSite<,>).IsAssignableFrom(v.GetType().GetGenericTypeDefinition()))
         return EmitSites(v, sb);
     else
         return EmitNamespace(v, sb);
 }
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:13,代码来源:JSEmitter.cs


示例8: CommonValidationResult

 /// <summary>
 /// Initializes a new instance of the <see cref="CommonValidationResult"/> class.
 /// </summary>
 /// <param name="rule">The rule.</param>
 /// <param name="target">The target.</param>
 /// <param name="message">The message.</param>
 /// <param name="success">if set to <c>true</c> [success].</param>
 public CommonValidationResult(IValidator rule, IValidatable target, string message, bool success)
 {
     Rule = rule;
     Target = target;
     Message = message;
     Success = success;
 }
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:14,代码来源:CommonValidationResult.cs


示例9: SetUp

 public override void SetUp()
 {
     base.SetUp();
     _collectionRepository = Substitute.For<IPagedCollectionRepository<Logic.Product.FindPagedCollection.ProductItem, Logic.Product.FindPagedCollection.Query>>();
     _validator = Substitute.For<IValidator<Logic.Product.FindPagedCollection.Query>>();
     _sut = new Logic.Product.FindPagedCollection.QueryHandler(_collectionRepository, _validator);
 }
开发者ID:tomekjanicki,项目名称:architecture2,代码行数:7,代码来源:FindPagedCollection.cs


示例10: Emitter

        public Emitter(IDictionary<string,
            TypeDefinition> typeDefinitions,
            BridgeTypes bridgeTypes,
            List<ITypeInfo> types,
            IValidator validator,
            IMemberResolver resolver,
            Dictionary<string, ITypeInfo> typeInfoDefinitions,
            ILogger logger)
        {
            this.Log = logger;

            this.Resolver = resolver;
            this.TypeDefinitions = typeDefinitions;
            this.TypeInfoDefinitions = typeInfoDefinitions;
            this.Types = types;
            this.BridgeTypes = bridgeTypes;

            this.BridgeTypes.InitItems(this);

            logger.Trace("Sorting types infos by name...");
            this.Types.Sort(this.CompareTypeInfosByName);
            logger.Trace("Sorting types infos by name done");

            this.SortTypesByInheritance();

            this.Validator = validator;
            this.AssignmentType = ICSharpCode.NRefactory.CSharp.AssignmentOperatorType.Any;
            this.UnaryOperatorType = ICSharpCode.NRefactory.CSharp.UnaryOperatorType.Any;
            this.JsDoc = new JsDoc();
        }
开发者ID:TinkerWorX,项目名称:Bridge,代码行数:30,代码来源:Emitter.cs


示例11: RuntimeConfiguration

 public RuntimeConfiguration(ProviderInfo providerInfo, ConnectionInfo connectionInfo, IValidator validator, ISqlDispatcher sqlDispatcher)
 {
     _providerInfo = providerInfo;
     _connectionInfo = connectionInfo;
     _validator = validator;
     _sqlDispatcher = sqlDispatcher;
 }
开发者ID:dradovic,项目名称:MigSharp,代码行数:7,代码来源:RuntimeConfiguration.cs


示例12: InvalidMessageTransformer

        public InvalidMessageTransformer(ConstraintValidatorContext constraintContext, 
            List<InvalidValue> results,
            System.Type @class,
            string propertyName /* nullable */,
            object value /* nullable */,
            object entity /* nullable */,
            IValidator validator,
            DefaultMessageInterpolatorAggregator defaultInterpolator,
            IMessageInterpolator userInterpolator /* nullable */)
        {
            if (constraintContext == null) throw new ArgumentNullException("constraintContext");
            if (results == null) throw new ArgumentNullException("results");
            if (@class == null) throw new ArgumentNullException("class");
            if (validator == null) throw new ArgumentNullException("valitor");
            if (defaultInterpolator == null) throw new ArgumentNullException("defaultInterpolator");

            this.constraintContext = constraintContext;
            this.results = results;
            [email protected] = @class;
            this.propertyName = propertyName;
            this.value = value;
            this.entity = entity;
            this.validator = validator;
            this.defaultInterpolator = defaultInterpolator;
            this.userInterpolator = userInterpolator;
        }
开发者ID:mpielikis,项目名称:nhibernate-contrib,代码行数:26,代码来源:InvalidMessageTransformer.cs


示例13: SetUp

 public override void SetUp()
 {
     base.SetUp();
     _validator = Substitute.For<IValidator<Logic.Product.Delete.Command>>();
     _repository = Substitute.For<Logic.Product.Delete.IDeleteProductRepository>();
     _sut = new Logic.Product.Delete.CommandHandler(_validator, _repository);
 }
开发者ID:tomekjanicki,项目名称:architecture2,代码行数:7,代码来源:Delete.cs


示例14: EmitSites

        /// <summary>
        /// Emits the sites.
        /// </summary>
        /// <param name="v">The v.</param>
        /// <param name="sb">The sb.</param>
        /// <returns></returns>
        private StringBuilder EmitSites(IValidator v, StringBuilder sb)
        {
            sb
                .Append("{ field: \"")
                .Append(v.Name)
                .Append("\", attributes: [");

            bool found = false;
            foreach (IValidator child in v.Children)
            {
                sb.Append("{ name: \"");
                sb.Append(GetSimpleTypeName(child));
                sb.Append("\"");

                foreach (string key in child.DefiningParams.Keys)
                {
                    sb.Append(",");
                    sb.Append(key);
                    sb.Append(": \"");
                    sb.Append(new NDjango.FiltersCS.EscapeJSFilter().Perform(Convert.ToString(child.DefiningParams[key])));
                    sb.Append("\"");
                }

                sb.Append("},");

                found = true;
            }

            if (found)
                sb.Remove(sb.Length - 1, 1);

            return sb.Append("]}");
        }
开发者ID:jijo-paulose,项目名称:bistro-framework,代码行数:39,代码来源:JSEmitter.cs


示例15: FluentValidationModelValidator

		public FluentValidationModelValidator(ModelMetadata metadata, ControllerContext controllerContext, IValidator validator)
			: base(metadata, controllerContext) {
			this.validator = validator;
			
			this.customizations = CustomizeValidatorAttribute.GetFromControllerContext(controllerContext) 
				?? new CustomizeValidatorAttribute();
		}
开发者ID:AVee,项目名称:ServiceStack,代码行数:7,代码来源:FluentValidationModelValidator.cs


示例16: ActivitiesController

 public ActivitiesController(IProcessQueries queryProcessor
                           , IHandleCommands<UpdateActivity> profileUpdateHandler
                           , IValidator<CreateImage> validateImage
                           , IHandleCommands<CreateImage> createImage
                           , IValidator<CreateLoadableFile> validateLoadableFile
                           , IHandleCommands<CreateLoadableFile> createLoadableFile
                           , IHandleCommands<CreateActivityDocument> createActivityDocument
                           , IHandleCommands<DeleteActivityDocument> deleteActivityDocument 
                           , IHandleCommands<RenameActivityDocument> renameActivityDocument
                           , IHandleCommands<CopyDeepActivity> copyDeepActivity
                           , IHandleCommands<CreateDeepActivity> createDeepActivity
                           , IHandleCommands<DeleteActivity> deleteActivity
                           , IHandleCommands<UpdateActivity> updateActivity )
 {
     _queryProcessor = queryProcessor;
     _profileUpdateHandler = profileUpdateHandler;
     _validateImage = validateImage;
     _createImage = createImage;
     _validateLoadableFile = validateLoadableFile;
     _createLoadableFile = createLoadableFile; 
     _createActivityDocument = createActivityDocument;
     _deleteActivityDocument = deleteActivityDocument;
     _renameActivityDocument = renameActivityDocument;
     _copyDeepActivity = copyDeepActivity;
     _createDeepActivity = createDeepActivity;
     _deleteActivity = deleteActivity;
     _updateActivity = updateActivity;
 }
开发者ID:saibalghosh,项目名称:Layout3,代码行数:28,代码来源:ActivitiesController.cs


示例17: AccountController

 public AccountController(IUserService userService, IValidator<RegisterForm> registerFormValidator, 
     IValidator<ChangePasswordForm> changePasswordFormValidator)
 {
     _userService = userService;
     _registerFormValidator = registerFormValidator;
     _changePasswordFormValidator = changePasswordFormValidator;
 }
开发者ID:rwhitmire,项目名称:DefectLog,代码行数:7,代码来源:AccountController.cs


示例18: FileController

 public FileController(IMapHandler newMapHandler, IFileView newFileView, IFileHandler newFileHandler, IValidator newValidator)
 {
     maphandler = newMapHandler;
     fileView = newFileView;
     fileHandler = newFileHandler;
     validator = newValidator;
 }
开发者ID:jamesgabiana,项目名称:PR283-Theseus-and-the-Minotaur-C-.Net,代码行数:7,代码来源:FileController.cs


示例19: GetValidatorsForProperty

		IEnumerable<ModelValidator> GetValidatorsForProperty(ModelMetadata metadata, ControllerContext context, IValidator validator) {
			var modelValidators = new List<ModelValidator>();

			if (validator != null) {
				var descriptor = validator.CreateDescriptor();

				var validatorsWithRules = from rule in descriptor.GetRulesForMember(metadata.PropertyName)
										  let propertyRule = (PropertyRule)rule
										  let validators = rule.Validators
										  where validators.Any()
										  from propertyValidator in validators
										  let modelValidatorForProperty = GetModelValidator(metadata, context, propertyRule, propertyValidator)
										  where modelValidatorForProperty != null
										  select modelValidatorForProperty;
					
				modelValidators.AddRange(validatorsWithRules);
			}

			if(validator != null && metadata.IsRequired && AddImplicitRequiredValidator) {
				bool hasRequiredValidators = modelValidators.Any(x => x.IsRequired);

				//If the model is 'Required' then we assume it must have a NotNullValidator. 
				//This is consistent with the behaviour of the DataAnnotationsModelValidatorProvider
				//which silently adds a RequiredAttribute

				if(! hasRequiredValidators) {
					modelValidators.Add(CreateNotNullValidatorForProperty(metadata, context));
				}
			}

			return modelValidators;
		}
开发者ID:grammarware,项目名称:fodder,代码行数:32,代码来源:src_ServiceStack_FluentValidation_Mvc3_FluentValidationModelValidatorProvider.cs


示例20: AddInterpolator

 public void AddInterpolator(Attribute attribute, IValidator validator)
 {
     DefaultMessageInterpolator interpolator = new DefaultMessageInterpolator();
     interpolator.Initialize(messageBundle, defaultMessageBundle, culture);
     interpolator.Initialize(attribute);
     interpolators[validator] = interpolator;
 }
开发者ID:mpielikis,项目名称:nhibernate-contrib,代码行数:7,代码来源:DefaultMessageInterpolatorAggregator.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IValue类代码示例发布时间:2022-05-24
下一篇:
C# IValidationErrors类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap