public void RegisterRuleConfigFactory(IRuleConfigFactory factory, Type validationAttributeType) { if (!typeof(ValidationAttribute).IsAssignableFrom(validationAttributeType)) { throw new ArgumentException("Provided type should be a ValidationAttribute or its subclass", "validationAttributeType"); } AddFactoriesForAttribute(validationAttributeType, factory); }
private void AddFactoriesForAttribute(Type attributeType, IRuleConfigFactory factory) { var attributeFactories = WriteableFactories.GetOrAdd(attributeType, at => new List <IRuleConfigFactory>()); attributeFactories.Add(factory); }