Esempio n. 1
0
 /// <summary>
 /// Adds both MVC model binding and data annotations localization to the application.
 /// </summary>
 /// <param name="mvc">The Microsoft.Extensions.DependencyInjection.IMvcBuilder.</param>
 /// <param name="resourceType">Type of resource source.</param>
 /// <returns>The Microsoft.Extensions.DependencyInjection.IMvcBuilder.</returns>
 public static IMvcBuilder AddModelLocalization(this IMvcBuilder mvc, Type resourceType)
 {
     return(mvc
            .AddModelBindingMessagesLocalization(resourceType)
            .AddDataAnnotationsLocalization(resourceType));
 }
Esempio n. 2
0
 /// <summary>
 /// Adds both MVC model binding and data annotations localization to the application.
 /// </summary>
 /// <typeparam name="TResource">Type of resource source.</typeparam>
 /// <param name="mvc">The Microsoft.Extensions.DependencyInjection.IMvcBuilder.</param>
 /// <returns>The Microsoft.Extensions.DependencyInjection.IMvcBuilder.</returns>
 public static IMvcBuilder AddModelLocalization <TResource>(this IMvcBuilder mvc) where TResource : class
 {
     return(mvc
            .AddModelBindingMessagesLocalization <TResource>()
            .AddDataAnnotationsLocalization <TResource>());
 }