public BindingBase ProvideBinding(IResourceContext context) { var binding = context.CreateModelBinding(PropertyPath); if (OneWay) { binding.Mode = BindingMode.OneWay; } BindingOptions.Apply(binding); var deserializer = ReplacementPipe.CreateDeserializer(context); binding.Converter = new StringTypeConverter(deserializer); binding.ValidationRules.Add(new ConversionValidator(deserializer, ConversionErrorStringProvider(context), binding.ConverterCulture)); var pipe = new ValidationPipe(); foreach (var validatorProvider in ValidationRules) { binding.ValidationRules.Add(validatorProvider.GetValidator(context, pipe)); } binding.ValidationRules.Add(pipe); return(binding); }
public override BindingBase ProvideBinding(IResourceContext context) { var binding = context.CreateModelBinding(PropertyPath); binding.Converter = GetValueConverter(context); BindingOptions.Apply(binding); var pipe = new ValidationPipe(); foreach (var validatorProvider in ValidationRules) { binding.ValidationRules.Add(validatorProvider.GetValidator(context, pipe)); } binding.ValidationRules.Add(pipe); return(binding); }
public BindingBase ProvideBinding(IResourceContext context) { var binding = context.CreateDirectModelBinding(); BindingOptions.Apply(binding); binding.Converter = new StringTypeConverter(Deserializer); binding.ValidationRules.Add(new ConversionValidator(Deserializer, ConversionErrorStringProvider(context), binding.ConverterCulture)); var pipe = new ValidationPipe(); foreach (var validatorProvider in ValidationRules) { binding.ValidationRules.Add(validatorProvider.GetValidator(context, pipe)); } binding.ValidationRules.Add(pipe); return(binding); }
public FieldValidator GetValidator(IResourceContext context, ValidationPipe pipe) { return(func(context, pipe)); }