public ICustomCommand Create(params dynamic[] args) { ICustomReceiver aReceiver = args.OfType <ICustomReceiver>().FirstOrDefault(); ICustomValidator aValidator = args.OfType <ICustomValidator>().FirstOrDefault(); return(new CustomCommand(aReceiver, aValidator)); }
public RegistrationModelValidator() { context = ContextProvider.GetApplicationContext(); customValidator = new CustomValidator <RegistrationModel>(); SetDefaultRules(); }
public void TestCustomValidator_Create() { IFactory <ICustomValidator> fact = new CustomValidatorFactory(); Assert.IsNotNull(fact); ICustomValidator validator = fact.Create(); Assert.IsNotNull(validator); }
public void SetCommand(ICustomCommand aCommand, ICustomValidator aValidator = null) { Validator = (aValidator == null) ? new CustomValidator() : aValidator; if (aCommand == null) { throw new ArgumentNullException("Command is null"); } Command = aCommand; }
public void AttachTo(ICustomReceiver aReceiver, ICustomValidator aValidator = null) { Validator = (aValidator == null) ? new CustomValidator() : aValidator; if (!Validator.IsValidArgument(aReceiver)) { throw new ArgumentNullException("Command receiver cannot be null"); } Receiver = aReceiver; }
public void SetCommand(ICustomCommand aCommand, ICustomValidator aValidator = null) { Validator = (aValidator == null) ? new CustomValidator() : aValidator; if (aCommand == null) { throw new ArgumentNullException("Command is null"); } Command = aCommand; }
public void AttachTo(ICustomReceiver aReceiver, ICustomValidator aValidator = null) { Validator = (aValidator == null) ? new CustomValidator() : aValidator; if (!Validator.IsValidArgument(aReceiver)) { throw new ArgumentNullException("Command receiver cannot be null"); } Receiver = aReceiver; }
public void AttachCommand(Action <object> anAction, ICustomValidator aValidator = null) { Validator = (aValidator == null) ? new CustomValidator() : aValidator; if (anAction == null) { throw new ArgumentNullException("Command action is null"); } CommandAction = anAction; }
public void AttachCommand(Action<object> anAction, ICustomValidator aValidator = null) { Validator = (aValidator == null) ? new CustomValidator() : aValidator; if (anAction == null) { throw new ArgumentNullException("Command action is null"); } CommandAction = anAction; }
public ICustomSender Create(params dynamic[] args) { ICustomCommand aCommand = args.OfType <ICustomCommand>().FirstOrDefault(); ICustomValidator aValidator = args.OfType <ICustomValidator>().FirstOrDefault(); if (aCommand == null) { return(new CustomSender()); } else { var retObj = new CustomSender(); retObj.SetCommand(aCommand, aValidator); return(retObj); } }
public ICustomReceiver Create(params dynamic[] args) { Action <object> anAction = args.OfType <Action <object> >().FirstOrDefault(); ICustomValidator aValidator = args.OfType <ICustomValidator>().FirstOrDefault(); if (anAction == null) { return(new CustomReceiver()); } else { var retObj = new CustomReceiver(); retObj.AttachCommand(anAction, aValidator); return(retObj); } }
public void RemoveCommand() { Validator = null; Command = null; }
public CustumerService(ICustumerRepository repo, IMapper mapper, ICustomValidator <InsertCustumer.Request> validator) { _repo = repo; _mapper = mapper; _validator = validator; }
protected StoreService(IDataContext <T> context, ICustomValidator <T> validator) { this.Context = context ?? throw new ArgumentNullException(nameof(context)); this.Validator = validator ?? throw new ArgumentNullException(nameof(validator)); }
/// <summary> /// Use this attribute to validate to model on the body of all incoming requests to this function using a custom validator /// </summary> /// <param name="type">The type of the model to be validated</param> /// <param name="resultParameterName">Paramer name to inject validation results. Must be of type <code>ICollection<ValidationResult></code></param> /// <param name="customValidatorFactory">A method that returns an instance of the custom validator to use</param> public CustomValidateAttribute(Type type, string resultParameterName, Func <ICustomValidator> customValidatorFactory) { this.type = type; this.paramName = resultParameterName; this.customValidator = customValidatorFactory(); }
public void Dettach() { Receiver = null; Validator = null; }
public QuizModelValidator() { customValidator = new CustomValidator <QuizModel>(); SetDefaultRules(); }
/// <summary> /// Use this attribute to validate to model on the body of all incoming requests to this function using a custom validator /// </summary> /// <param name="type">The type of the model to be validated</param> /// <param name="resultParameterName">Paramer name to inject validation results. Must be of type <code>ICollection<ValidationResult></code>/param> /// <param name="customValidatorType">Type of the custom validator to use</param> public CustomValidateAttribute(Type type, string resultParameterName, Type customValidatorType) { this.type = type; this.paramName = resultParameterName; this.customValidator = Activator.CreateInstance(customValidatorType) as ICustomValidator; }
public NewTestModelValidator() { customValidator = new CustomValidator <NewTestModel>(); SetDefaultRules(); }
public void DettachCommand() { Validator = null; CommandAction = null; }
public LoginModelValidator() { customValidator = new CustomValidator <LoginModel>(); SetDefaultRules(); }
protected ModelValidator(ICustomValidator <TModel> customValidator) { CascadeMode = DefaultCascadeMode; _customValidator = customValidator; }
protected virtual string CustomValidate(RowValidationContext context, Field field, ICustomValidator validator) { return(validator.Validate(context)); }
public bool IsValid(ICustomValidator validator, List<IndicatorValue> values) { bool isValid = true; foreach (DynamicContainer cnt in controlList) { if (cnt.Control == null) continue; string message = validator.Valid(cnt.Indicator, values); indicatorErrors.SetError(cnt.Control, message); if (!string.IsNullOrEmpty(message)) isValid = false; } return isValid; }