Skip to content

Commit

Permalink
Revert "[core] factory methods for registering services, part 2 (#17004
Browse files Browse the repository at this point in the history
…)"

This reverts commit 79a44ff.
  • Loading branch information
PureWeen committed Aug 29, 2023
1 parent 9700a48 commit ed9a1fc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
6 changes: 0 additions & 6 deletions eng/BannedSymbols.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
M:Android.Content.Res.ColorStateList.#ctor(System.Int32[][],System.Int32[]);Use Microsoft.Maui.PlatformInterop.Get*ColorStateList() Java methods instead
M:Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddScoped(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Type,System.Type);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddScoped`1(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddScoped`2(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddSingleton(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Type,System.Type);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddSingleton`1(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddSingleton`2(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddTransient(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Type,System.Type);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddTransient`1(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAddTransient`2(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddScoped(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Type,System.Type);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddScoped`1(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddScoped`2(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Type,System.Type);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton`1(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton`2(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddTransient(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Type,System.Type);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddTransient`1(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead
M:Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddTransient`2(Microsoft.Extensions.DependencyInjection.IServiceCollection);Use a Factory method to register the service instead
M:Microsoft.Maui.Hosting.ImageSourceServiceCollectionExtensions.AddService`2(Microsoft.Maui.Hosting.IImageSourceServiceCollection);Use a Factory method to register the service instead
M:Microsoft.Maui.Hosting.MauiHandlersCollectionExtensions.AddHandler(Microsoft.Maui.Hosting.IMauiHandlersCollection,System.Type,System.Type);Use a Factory method to register the service instead
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ public static IMauiBlazorWebViewBuilder AddMauiBlazorWebView(this IServiceCollec
services.AddBlazorWebView();
services.TryAddSingleton(new BlazorWebViewDeveloperTools { Enabled = false });
#if WEBVIEW2_MAUI
services.TryAddSingleton(_ => new MauiBlazorMarkerService());
services.TryAddSingleton<MauiBlazorMarkerService>();
services.ConfigureMauiHandlers(static handlers => handlers.AddHandler<IBlazorWebView>(_ => new BlazorWebViewHandler()));
return new MauiBlazorWebViewBuilder(services);
#elif WEBVIEW2_WINFORMS
services.TryAddSingleton(_ => new WindowsFormsBlazorMarkerService());
services.TryAddSingleton<WindowsFormsBlazorMarkerService>();
return new WindowsFormsBlazorWebViewBuilder(services);
#elif WEBVIEW2_WPF
services.TryAddSingleton(_ => new WpfBlazorMarkerService());
services.TryAddSingleton<WpfBlazorMarkerService>();
return new WpfBlazorWebViewBuilder(services);
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static partial class AppHostBuilderExtensions
{
public static MauiAppBuilder ConfigureEffects(this MauiAppBuilder builder, Action<IEffectsBuilder> configureDelegate)
{
builder.Services.TryAddSingleton(svc => new EffectsFactory(svc.GetServices<EffectsRegistration>()));
builder.Services.TryAddSingleton<EffectsFactory>();
if (configureDelegate != null)
{
builder.Services.AddSingleton<EffectsRegistration>(new EffectsRegistration(configureDelegate));
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Xaml/Hosting/AppHostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static MauiAppBuilder SetupDefaults(this MauiAppBuilder builder)
DependencyService.Register<FontNamedSizeService>();
#pragma warning restore CS0612, CA1416 // Type or member is obsolete
#endif
builder.Services.AddScoped(_ => new HideSoftInputOnTappedChangedManager());
builder.Services.AddScoped<HideSoftInputOnTappedChangedManager>();
builder.ConfigureImageSourceHandlers();
builder
.ConfigureMauiHandlers(handlers =>
Expand Down

0 comments on commit ed9a1fc

Please sign in to comment.