Пример #1
0
 public static IMvcBuilder AddCustomDataAnnotationLocalization(this IMvcBuilder builder, IServiceCollection services, Type typeOfSharedResource)
 {
     builder.AddDataAnnotationsLocalization(option =>
     {
         var localizer = new FactoryLocalizer().Set(services, typeOfSharedResource);
         option.DataAnnotationLocalizerProvider = (type, factory) => localizer;
     });
     return(builder);
 }
Пример #2
0
        public static IMvcBuilder AddCustomDataAnnotationLocalization(this IMvcBuilder builder, IServiceCollection services, Type SharedResource)
        {
            builder.AddDataAnnotationsLocalization(Options =>
            {
                var Localizer = new FactoryLocalizer().Set(services, SharedResource);

                Options.DataAnnotationLocalizerProvider = (t, f) => Localizer;
            });

            return(builder);
        }