File tree Expand file tree Collapse file tree
src/Component/BlazorComponent/Extensions/DependencyInjection Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ namespace Microsoft.Extensions.DependencyInjection
66 public static class ServiceCollectionExtensions
77 {
88 public static IBlazorComponentBuilder AddBlazorComponent ( this IServiceCollection services ,
9- Action < BlazorComponentOptions > ? optionsAction = null )
9+ Action < BlazorComponentOptions > ? optionsAction = null ,
10+ ServiceLifetime masaBlazorServiceLifetime = ServiceLifetime . Scoped )
1011 {
1112 if ( optionsAction is not null )
1213 {
@@ -16,7 +17,8 @@ public static IBlazorComponentBuilder AddBlazorComponent(this IServiceCollection
1617 services . TryAddScoped < LocalStorage > ( ) ;
1718 services . TryAddScoped < Document > ( ) ;
1819 services . TryAddScoped ( serviceProvider => new Window ( serviceProvider . GetRequiredService < Document > ( ) ) ) ;
19- services . TryAddScoped < IPopupProvider , PopupProvider > ( ) ;
20+ services . TryAdd ( new ServiceDescriptor ( typeof ( IPopupProvider ) , typeof ( PopupProvider ) ,
21+ masaBlazorServiceLifetime ) ) ;
2022 services . TryAddSingleton < IComponentIdGenerator , GuidComponentIdGenerator > ( ) ;
2123 services . AddScoped ( typeof ( BDragDropService ) ) ;
2224 services . AddSingleton < IComponentActivator , AbstractComponentActivator > ( ) ;
You can’t perform that action at this time.
0 commit comments