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


C# IValidator类代码示例

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


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


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