protected override ValidationResult IsValid(object value, ValidationContext validationContext) { lock (_syncLock) { if (value == null) return ValidationResult.Success; string convertedValue; try { convertedValue = Convert.ToString(value); } catch (FormatException) { return new ValidationResult("Failed to convert value to string."); } var emailParser = new EmailAddressValidator(); if (emailParser.IsEmailValid(convertedValue)) return ValidationResult.Success; var memberNames = (validationContext.MemberName != null) ? new[] { validationContext.MemberName } : null; return new ValidationResult( FormatErrorMessage(validationContext.DisplayName), memberNames); } }