Пример #1
0
        public static void AddMComponents(this IServiceCollection pServices, Action <MComponentSettings> pOptions = null)
        {
            var settings = new MComponentSettings();

            pOptions?.Invoke(settings);
            pServices.AddSingleton(settings);

            if (settings.RegisterResourceLocalizer)
            {
                pServices.AddLocalization(options => options.ResourcesPath = "Resources");
            }

            if (settings.SetRequestLocalizationOptions)
            {
                pServices.Configure <RequestLocalizationOptions>(options =>
                {
                    options.SupportedUICultures = settings.SupportedCultures;
                });
            }
            if (settings.RegisterStringLocalizer)
            {
                pServices.AddSingleton <IStringLocalizer, StringLocalizer>();
            }

            pServices.AddBlazoredLocalStorage();

            pServices.AddScoped <MLocalStorageService>();
            pServices.AddScoped <MGridStateService>();
        }
Пример #2
0
        public static void AddMComponents(this IServiceCollection pServices, Action <MComponentSettings> pOptions = null)
        {
            pServices.AddLocalization(options => options.ResourcesPath = "Resources");
            pServices.Configure <RequestLocalizationOptions>(options =>
            {
                options.SupportedUICultures = MComponentsLocalization.SupportedCultures;
            });

            pServices.AddBlazoredLocalStorage();

            pServices.AddScoped <MLocalStorageService>();
            pServices.AddScoped <MGridStateService>();

            var settings = new MComponentSettings();

            if (pOptions != null)
            {
                pOptions(settings);
            }
            pServices.AddSingleton(settings);
        }