Files
WinGreedWpf/WinGreedWPF/StartupHelpers/ServiceExtensions.cs
2025-07-06 17:36:00 +02:00

16 lines
467 B
C#

using Microsoft.Extensions.DependencyInjection;
using System;
namespace WinGreedWPF.StartupHelpers;
public static class ServiceExtensions
{
public static void AddFormFactory<TForm>(this IServiceCollection services)
where TForm : class
{
services.AddTransient<TForm>();
services.AddSingleton<Func<TForm>>(x => () => x.GetService<TForm>()!);
services.AddSingleton<IAbstractFactory<TForm>, AbstractFactory<TForm>>();
}
}