GetValidator() 공개 정적인 메소드

public static GetValidator ( string name ) : Type
name string
리턴 System.Type
예제 #1
0
        public void CreateValidator()
        {
            if (ValidationType == null)
            {
                _validator = ValidatorRegistry.DefaultValidator;
                return;
            }

            var type = ValidatorRegistry.GetValidator(ValidationType);

            try
            {
                _validator = (ConfigurationValidatorBase)Activator.CreateInstance(
                    type,
                    BindingFlags.CreateInstance | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public,
                    null,
                    ValidationParameter == null ? null : new object[] { ValidationParameter },
                    CultureInfo.InvariantCulture);
            }
            catch (MissingMethodException)
            {
                RollbarLocator.RollbarInstance.Error($"type: {ValidationType}; parameter: {ValidationParameter}; is null ? {ValidationParameter == null}");
                throw;
            }
        }
        public void CreateValidator()
        {
            if (ValidationType == null)
            {
                _validator = ValidatorRegistry.DefaultValidator;
                return;
            }

            var type = ValidatorRegistry.GetValidator(this.ValidationType);

            _validator = (ConfigurationValidatorBase)Activator.CreateInstance(
                type,
                BindingFlags.CreateInstance | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public,
                null,
                ValidationParameter == null ? null : new object[] { this.ValidationParameter },
                CultureInfo.InvariantCulture);
        }