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; }
public AccountController(IUserService userService, IValidator<RegisterForm> registerFormValidator, IValidator<ChangePasswordForm> changePasswordFormValidator) { _userService = userService; _registerFormValidator = registerFormValidator; _changePasswordFormValidator = changePasswordFormValidator; }
/// <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("]}"); }
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; }
public CardService(ICardRepository cardRepository, IValidator validator, IProjectService projectService, ISession session) { _cardRepository = cardRepository; _validator = validator; _projectService = projectService; _session = session; }
public ValidationTemplate(INotifyPropertyChanged target) { this.target = target; validator = GetValidator(target.GetType()); validationResult = validator.Validate(target); target.PropertyChanged += Validate; }
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; this.@class = @class; this.propertyName = propertyName; this.value = value; this.entity = entity; this.validator = validator; this.defaultInterpolator = defaultInterpolator; this.userInterpolator = userInterpolator; }
/// <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; }
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(); }
public FluentValidationModelValidator(ModelMetadata metadata, ControllerContext controllerContext, IValidator validator) : base(metadata, controllerContext) { this.validator = validator; this.customizations = CustomizeValidatorAttribute.GetFromControllerContext(controllerContext) ?? new CustomizeValidatorAttribute(); }
public PhoneBookCRUDService() { _PhonesUnitOfWork = new PhonesUnitOfWork(); _PersonConverter = new PersonModelConverter(); _PhoneNumberConverter = new PhoneNumberModelConverter(); _PersonValidator = new PersonNameValidator(_PersonConverter); }
private void GetValue(IValidator inputValidator, ValidationMetaData metaData, string parentKey) { 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 currentKey = string.IsNullOrEmpty(parentKey) ? member.Key : string.Format("{0}.{1}", parentKey, member.Key.ToCamelCase()); if (validator is ChildValidatorAdaptor) { var childValidator = (validator as ChildValidatorAdaptor).Validator; GetValue(childValidator, metaData, currentKey); } else if(validator is IPropertyValidator) GenerateFor(metaData, currentKey, validator as IPropertyValidator); } } } }
public AbstractCustomer(CustomerType customerType) { this._accountList = new List<IAccount>(); this._customerType = customerType; this._validator = Validation.VALIDATOR; this._accountFactory = AccountFactory.ACCOUNT_FACTORY; }
public AnswersViewModel( IEnumerable<Answer> answers, IValidator<Answer> answerValidator, IValidator<AssociatedSubject> subjectValidator, ISubjectQuery subjectQuery, Guid busId) { if (answerValidator == null) throw new ArgumentNullException("answerValidator"); if (subjectValidator == null) throw new ArgumentNullException("subjectValidator"); if (subjectQuery == null) throw new ArgumentNullException("subjectQuery"); _busId = busId; _answerValidator = answerValidator; _subjectValidator = subjectValidator; _subjectQuery = subjectQuery; InitializeAnswers(answers); InitializeCommands(); }
public Prompt(IConsole console, ICalculator calculator, IValidator validator, ILogger logger) { _console = console; _calculator = calculator; _validator = validator; _logger = logger; }
public void AddInterpolator(Attribute attribute, IValidator validator) { DefaultMessageInterpolator interpolator = new DefaultMessageInterpolator(); interpolator.Initialize(messageBundle, defaultMessageBundle, culture); interpolator.Initialize(attribute); interpolators[validator] = interpolator; }
/// <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); }
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() ); }
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); }
private static void ValidateFormat(List<char> delimiters, string numbers, IValidator validator) { if (!validator.Validate(numbers, delimiters)) { throw new CalculatorFormatException(validator.LastErrorMessage); } }
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); }
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); } } } } }
public RuntimeConfiguration(ProviderInfo providerInfo, ConnectionInfo connectionInfo, IValidator validator, ISqlDispatcher sqlDispatcher) { _providerInfo = providerInfo; _connectionInfo = connectionInfo; _validator = validator; _sqlDispatcher = sqlDispatcher; }
IEnumerable<ModelValidator> GetValidatorsForModel(ModelMetadata metadata, ControllerContext context,IValidator validator) { if (validator != null) { yield return new FVModelValidator(metadata, context, validator); } }
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; }
public FileController(IMapHandler newMapHandler, IFileView newFileView, IFileHandler newFileHandler, IValidator newValidator) { maphandler = newMapHandler; fileView = newFileView; fileHandler = newFileHandler; validator = newValidator; }
public ArticleFactory(IQueryRepository queryRepository, IValidator<Article> articleValidator, IValidator<Comment> commentValidator, IMappingService mappingService) { _queryRepository = queryRepository; _articleValidator = articleValidator; _commentValidator = commentValidator; _mappingService = mappingService; }
/// <summary> /// Constructor /// </summary> /// <param name="validator"></param> /// <param name="valueList">A list of valid value. If null an error occurred. The index must match the index of ValueList, ObjectList and DisplayStringList</param> /// <param name="displayStringList">A list of displayString. Can be null. The index must match the index of ValueList, ObjectList and DisplayStringList</param> /// <param name="specialList">A list of object that can be converted to value. Can be null. The index must match the index of ValueList, ObjectList and DisplayStringList</param> /// <param name="specialType">The type of object stored in the specialList collection.</param> public ValueMapping(IValidator validator, System.Collections.IList valueList, System.Collections.IList displayStringList, System.Collections.IList specialList, Type specialType) { ValueList = valueList; DisplayStringList = displayStringList; SpecialList = specialList; if (validator != null) BindValidator(validator); }
#pragma warning disable 1591 // Xml Comments public ValidationMetaData GenerateFrom(IValidator inputValidator) { var metaData = new ValidationMetaData(); GetValue(inputValidator, metaData, String.Empty); return metaData; }
public CustomerController(IConversation conversation, IMappingEngine mapper, CustomerRepository repository, IValidator validator, IStringConverter<Customer> stringConverter) { _conversation = conversation; _mapper = mapper; _repository = repository; _validator = validator; _stringConverter = stringConverter; }
/// <summary> CTor</summary> /// <param name="territoryId">PK value for Territory which data should be fetched into this Territory object</param> /// <param name="validator">The custom validator object for this TerritoryEntity</param> /// <remarks>The entity is not fetched by this constructor. Use a DataAccessAdapter for that.</remarks> public TerritoryEntity(System.String territoryId, IValidator validator) : base("TerritoryEntity") { InitClassEmpty(validator, null); this.TerritoryId = territoryId; }
/// <summary> CTor</summary> /// <param name="validator">The custom validator object for this EmployeeDetailEntity</param> public EmployeeDetailEntity(IValidator validator) { InitClassEmpty(validator, null); }
/// <summary> CTor</summary> /// <param name="validator">The custom validator object for this VwGetCallsEntity</param> public VwGetCallsEntity(IValidator validator) : base("VwGetCallsEntity") { InitClassEmpty(validator, CreateFields()); }
/// <summary> CTor</summary> /// <param name="documentNode">PK value for Document which data should be fetched into this Document object</param> /// <param name="validator">The custom validator object for this DocumentEntity</param> public DocumentEntity(System.String documentNode, IValidator validator) { InitClassEmpty(validator, null); this.DocumentNode = documentNode; }
/// <summary> /// Initializes a new instance of the <see cref="ValidationContext<T>"/> class. /// </summary> /// <param name="entity">The entity.</param> /// <param name="validator">The validator.</param> public ValidationContext(T entity, IValidator <T> validator) : this(entity, validator, new ValidationResults()) { }
public UpdateModuleTypeDetailsHandler(IModuleTypeRepository moduleTypeRepository, IValidator <UpdateModuleTypeDetails> validator) { _moduleTypeRepository = moduleTypeRepository; _validator = validator; }
/// <summary> CTor</summary> /// <param name="validator">The custom validator object for this SystemDataEntity</param> public SystemDataEntity(IValidator validator) { InitClassEmpty(validator, null); }
/// <summary> CTor</summary> /// <param name="productId">PK value for ProductProductPhoto which data should be fetched into this ProductProductPhoto object</param> /// <param name="productPhotoId">PK value for ProductProductPhoto which data should be fetched into this ProductProductPhoto object</param> /// <param name="validator">The custom validator object for this ProductProductPhotoEntity</param> /// <remarks>The entity is not fetched by this constructor. Use a DataAccessAdapter for that.</remarks> public ProductProductPhotoEntity(System.Int32 productId, System.Int32 productPhotoId, IValidator validator) : base("ProductProductPhotoEntity") { InitClassEmpty(validator, null); this.ProductId = productId; this.ProductPhotoId = productPhotoId; }
public EventRepository(IElasticClient elasticClient, IValidator <PersistentEvent> validator = null, IMessagePublisher messagePublisher = null) : base(elasticClient, validator, null, messagePublisher) { EnableCache = false; BatchNotifications = true; }
/// <summary> CTor</summary> /// <param name="iD">PK value for SystemData which data should be fetched into this SystemData object</param> /// <param name="validator">The custom validator object for this SystemDataEntity</param> public SystemDataEntity(System.Int32 iD, IValidator validator) { InitClassEmpty(validator, null); this.ID = iD; }
/// <summary> CTor</summary> /// <param name="validator">The custom validator object for this TerritoryEntity</param> public TerritoryEntity(IValidator validator) : base("TerritoryEntity") { InitClassEmpty(validator, null); }
/// <summary> CTor</summary> /// <param name="validator">The custom validator object for this SpecialOfferEntity</param> public SpecialOfferEntity(IValidator validator) : base("SpecialOfferEntity") { InitClassEmpty(validator, null); }
/// <summary> /// CTor /// </summary> /// <param name="addressID">PK value for Address which data should be fetched into this Address object</param> /// <param name="validator">The custom validator object for this AddressEntity</param> public AddressEntity(System.Int32 addressID, IValidator validator) : base(addressID, validator) { }
/// <summary>CTor</summary> /// <param name="categoryId">PK value for Category which data should be fetched into this Category object</param> /// <param name="validator">The custom validator object for this CategoryEntity</param> public CategoryEntity(System.Int32 categoryId, IValidator validator) : base("CategoryEntity") { InitClassFetch(categoryId, validator, null); }
public CreateMarkCommandHandler(WordschatzContext dbContext, IValidator <CreateMarkCommand> validator) : base(dbContext, validator) { }
/// <summary> CTor</summary> /// <param name="validator">The custom validator object for this PhysicianEventAssignmentEntity</param> public PhysicianEventAssignmentEntity(IValidator validator) : base("PhysicianEventAssignmentEntity") { InitClassEmpty(validator, CreateFields()); }
/// <summary> CTor</summary> /// <param name="validator">The custom validator object for this DocumentEntity</param> public DocumentEntity(IValidator validator) { InitClassEmpty(validator, null); }
/// <summary> CTor</summary> /// <param name="physicianId">PK value for PhysicianEventAssignment which data should be fetched into this PhysicianEventAssignment object</param> /// <param name="eventId">PK value for PhysicianEventAssignment which data should be fetched into this PhysicianEventAssignment object</param> /// <param name="validator">The custom validator object for this PhysicianEventAssignmentEntity</param> /// <remarks>The entity is not fetched by this constructor. Use a DataAccessAdapter for that.</remarks> public PhysicianEventAssignmentEntity(System.Int64 physicianId, System.Int64 eventId, IValidator validator) : base("PhysicianEventAssignmentEntity") { InitClassEmpty(validator, CreateFields()); this.PhysicianId = physicianId; this.EventId = eventId; }
/// <summary> /// Validates certain properties of the specified instance. /// </summary> /// <param name="instance">The object to validate</param> /// <param name="properties">The names of the properties to validate.</param> /// <returns>A ValidationResult object containing any validation failures.</returns> public static ValidationResult Validate <T>(this IValidator <T> validator, T instance, params string[] properties) { var context = new ValidationContext <T>(instance, new PropertyChain(), new MemberNameValidatorSelector(properties)); return(validator.Validate(context)); }
/// <summary> /// Validates certain properties of the specified instance. /// </summary> /// <param name="validator">The current validator</param> /// <param name="instance">The object to validate</param> /// <param name="propertyExpressions">Expressions to specify the properties to validate</param> /// <returns>A ValidationResult object containing any validation failures</returns> public static ValidationResult Validate <T>(this IValidator <T> validator, T instance, params Expression <Func <T, object> >[] propertyExpressions) { var context = new ValidationContext <T>(instance, new PropertyChain(), MemberNameValidatorSelector.FromExpressions(propertyExpressions)); return(validator.Validate(context)); }
public GetPensionRegulatorQueryHandler(IValidator <GetPensionRegulatorRequest> validator, IPensionRegulatorService pensionRegulatorService) { _validator = validator; _pensionRegulatorService = pensionRegulatorService; }
/// <summary>CTor</summary> /// <param name="organizationId">PK value for Organization which data should be fetched into this Organization object</param> /// <param name="validator">The custom validator object for this OrganizationEntity</param> public OrganizationEntity(System.Int32 organizationId, IValidator validator):base("OrganizationEntity") { InitClassFetch(organizationId, validator, null); }
/// <summary> CTor</summary> /// <param name="validator">The custom validator object for this dboVersionInfoEntity</param> public dboVersionInfoEntity(IValidator validator) { InitClassEmpty(validator, null); }
/// <summary> CTor</summary> /// <param name="specialOfferId">PK value for SpecialOffer which data should be fetched into this SpecialOffer object</param> /// <param name="validator">The custom validator object for this SpecialOfferEntity</param> /// <remarks>The entity is not fetched by this constructor. Use a DataAccessAdapter for that.</remarks> public SpecialOfferEntity(System.Int32 specialOfferId, IValidator validator) : base("SpecialOfferEntity") { InitClassEmpty(validator, null); this.SpecialOfferId = specialOfferId; }
/// <summary> CTor</summary> /// <param name="validator">The custom validator object for this ProductCostHistoryEntity</param> public ProductCostHistoryEntity(IValidator validator):base("ProductCostHistoryEntity") { InitClassEmpty(validator, null); }
public UpdateSiteDetailsHandler(ISiteRepository siteRepository, IValidator <UpdateSiteDetails> validator) { _siteRepository = siteRepository; _validator = validator; }
public static Task ValidateOptionalAsync(this IValidator validator, object value, IList <string> errors, ValidationContext context = null) { return(validator.ValidateAsync(value, (context ?? ValidContext).Optional(true), errors.Add)); }
/// <summary> CTor</summary> /// <param name="validator">The custom validator object for this ProductProductPhotoEntity</param> public ProductProductPhotoEntity(IValidator validator) : base("ProductProductPhotoEntity") { InitClassEmpty(validator, null); }
/// <summary> CTor</summary> /// <param name="productId">PK value for ProductCostHistory which data should be fetched into this ProductCostHistory object</param> /// <param name="startDate">PK value for ProductCostHistory which data should be fetched into this ProductCostHistory object</param> /// <param name="validator">The custom validator object for this ProductCostHistoryEntity</param> /// <remarks>The entity is not fetched by this constructor. Use a DataAccessAdapter for that.</remarks> public ProductCostHistoryEntity(System.Int32 productId, System.DateTime startDate, IValidator validator):base("ProductCostHistoryEntity") { InitClassEmpty(validator, null); this.ProductId = productId; this.StartDate = startDate; }
public AddTodoListItemCommandHandler(ITodoListItemsRepository todoListItemsRepository , IValidator <AddTodoListItemCommand> validator) { _todoListItemsRepository = todoListItemsRepository; _validator = validator; }