private static void ValidateAttributeFactory(AngularDataAnnotationsModelValidationFactory factory)
 {
     if (factory == null)
     {
         throw new ArgumentNullException("factory");
     }
 }
 private static void AddValidationAttributeAdapter(
     Dictionary <Type, AngularDataAnnotationsModelValidationFactory> dictionary, Type validataionAttributeType,
     AngularDataAnnotationsModelValidationFactory factory)
 {
     if (validataionAttributeType != null)
     {
         dictionary.Add(validataionAttributeType, factory);
     }
 }
        /// <summary>
        /// Registers the default adapter.
        /// </summary>
        /// <param name="adapterType">Type of the adapter.</param>
        public static void RegisterDefaultAdapter(Type adapterType)
        {
            ValidateAttributeAdapterType(adapterType);
            ConstructorInfo constructor = GetAttributeAdapterConstructor(typeof(ValidationAttribute), adapterType);

            DefaultAttributeFactory =
                (metadata, context, attribute) =>
                (AngularModelValidator)constructor.Invoke(new object[] { metadata, context, attribute });
        }
        /// <summary>
        /// Registers an adapter factory for the validation provider.
        /// </summary>
        /// <param name="attributeType">Type of the attribute.</param>
        /// <param name="factory">The factory that will be used to create the <see cref="AngularModelValidator"/> object for the specified attribute.</param>
        public static void RegisterAdapterFactory(Type attributeType, AngularDataAnnotationsModelValidationFactory factory)
        {
            ValidateAttributeType(attributeType);
            ValidateAttributeFactory(factory);

            AdaptersLock.EnterWriteLock();

            try
            {
                AttributeFactories[attributeType] = factory;
            }
            finally
            {
                AdaptersLock.ExitWriteLock();
            }
        }
        /// <summary>
        /// Registers the default adapter factory.
        /// </summary>
        /// <param name="factory">The factory that will be used to create the <see cref="AngularModelValidator"/> object for the specified attribute.</param>
        public static void RegisterDefaultAdapterFactory(AngularDataAnnotationsModelValidationFactory factory)
        {
            ValidateAttributeFactory(factory);

            DefaultAttributeFactory = factory;
        }