Beispiel #1
0
        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);
        }
Beispiel #2
0
        public BindingBase ProvideBinding(IResourceContext context)
        {
            var binding = context.CreateModelBinding(PropertyPath);

            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);
        }