private static Validator <T> CreateValidator <T>(string ruleset, bool cacheValidator) { Validator <T> validator = null; if (cacheValidator) { lock (ValidationFactory.attributeAndDefaultConfigurationValidatorsCacheLock) { ValidationFactory.ValidatorCacheKey key = new ValidationFactory.ValidatorCacheKey(typeof(T), ruleset, true); Validator validator2; if (ValidationFactory.attributeAndDefaultConfigurationValidatorsCache.TryGetValue(key, out validator2)) { return((Validator <T>)validator2); } Validator validator3 = ValidationFactory.InnerCreateValidatorFromAttributes(typeof(T), ruleset); validator = ValidationFactory.WrapAndInstrumentValidator <T>(validator3); ValidationFactory.attributeAndDefaultConfigurationValidatorsCache[key] = validator; return(validator); } } Validator validator4 = ValidationFactory.InnerCreateValidatorFromAttributes(typeof(T), ruleset); validator = ValidationFactory.WrapAndInstrumentValidator <T>(validator4); return(validator); }
private static Validator CreateValidator(Type targetType, string ruleset, bool cacheValidator) { Validator validator = null; if (cacheValidator) { lock (ValidationFactory.attributeAndDefaultConfigurationValidatorsCacheLock) { ValidationFactory.ValidatorCacheKey key = new ValidationFactory.ValidatorCacheKey(targetType, ruleset, false); Validator result; if (ValidationFactory.attributeAndDefaultConfigurationValidatorsCache.TryGetValue(key, out result)) { return(result); } Validator validator2 = ValidationFactory.InnerCreateValidatorFromAttributes(targetType, ruleset); validator = ValidationFactory.WrapAndInstrumentValidator(validator2); ValidationFactory.attributeAndDefaultConfigurationValidatorsCache[key] = validator; return(validator); } } Validator validator3 = ValidationFactory.InnerCreateValidatorFromAttributes(targetType, ruleset); validator = ValidationFactory.WrapAndInstrumentValidator(validator3); return(validator); }
public static Validator CreateValidatorFromAttributes(Type targetType, string ruleset) { if (ruleset == null) { throw new ArgumentNullException("ruleset"); } Validator validator = null; lock (ValidationFactory.attributeOnlyValidatorsCacheLock) { ValidationFactory.ValidatorCacheKey key = new ValidationFactory.ValidatorCacheKey(targetType, ruleset, false); Validator result; if (ValidationFactory.attributeOnlyValidatorsCache.TryGetValue(key, out result)) { return(result); } Validator validator2 = ValidationFactory.InnerCreateValidatorFromAttributes(targetType, ruleset); validator = ValidationFactory.WrapAndInstrumentValidator(validator2); ValidationFactory.attributeOnlyValidatorsCache[key] = validator; } return(validator); }
public static Validator <T> CreateValidatorFromAttributes <T>(string ruleset) { if (ruleset == null) { throw new ArgumentNullException("ruleset"); } Validator <T> validator = null; lock (ValidationFactory.attributeOnlyValidatorsCacheLock) { ValidationFactory.ValidatorCacheKey key = new ValidationFactory.ValidatorCacheKey(typeof(T), ruleset, true); Validator validator2; if (ValidationFactory.attributeOnlyValidatorsCache.TryGetValue(key, out validator2)) { return((Validator <T>)validator2); } Validator validator3 = ValidationFactory.InnerCreateValidatorFromAttributes(typeof(T), ruleset); validator = ValidationFactory.WrapAndInstrumentValidator <T>(validator3); ValidationFactory.attributeOnlyValidatorsCache[key] = validator; } return(validator); }