/// <summary> /// Assign a new custom provider. /// </summary> /// <param name="provider"> </param> public static void Assign(ValidationAttributesStringProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } _provider = provider; }
/// <summary> /// Assign a new custom provider. /// </summary> /// <param name="provider"> </param> public static void Assign(ValidationAttributesStringProvider provider) { if (provider == null) throw new ArgumentNullException("provider"); _provider = provider; }
private void AddValidationPromptsIfMissing() { if (!DefaultUICulture.IsActive) return; var prompt = _repository.GetPrompt(DefaultUICulture.Value, new TypePromptKey(typeof(StringLengthAttribute).FullName, "class")); if (prompt == null) { var provider = new ValidationAttributesStringProvider(); foreach (var typePrompt in provider.GetPrompts(DefaultUICulture.Value)) { if (!string.IsNullOrEmpty(typePrompt.TranslatedText)) _repository.Save(DefaultUICulture.Value, typePrompt.TypeFullName, typePrompt.TextName, typePrompt.TranslatedText); } } }