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); }
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); }