protected override void DoValidate(T objectToValidate, object currentTarget, string key, ValidationResults validationResults) { Type typeBeingValidated = typeof(T); _instrumentationProvider.NotifyConfigurationCalled(typeBeingValidated); try { WrappedValidator.DoValidate(objectToValidate, currentTarget, key, validationResults); if (validationResults.IsValid) { _instrumentationProvider.NotifyValidationSucceeded(typeBeingValidated); } else { _instrumentationProvider.NotifyValidationFailed(typeBeingValidated, validationResults); } } catch (Exception ex) { _instrumentationProvider.NotifyValidationException(typeBeingValidated, ex.Message, ex); throw; } }
public override IList <string> Validate(IReadOnlyCollection <string> source) { var result = WrappedValidator?.Validate(source) ?? new List <string>(); result.AddRange(source.Where(x => IPAddress.TryParse(x, out var temp)).ToList()); return(result); }
public override IList <string> Validate(IReadOnlyCollection <string> source) { var result = WrappedValidator?.Validate(source) ?? new List <string>(); var curResult = source.Where(x => Uri.IsWellFormedUriString(x, UriKind.Absolute)) .Select(x => x.RemoveProtocol()).ToList(); result.AddRange(curResult); return(result); }