SUBD_SportCompetitions/SportCompetitionsView/Program.cs

46 lines
1.6 KiB
C#

using System;
using Microsoft.Extensions.DependencyInjection;
using SportCompetitionsBusinessLogic.BusinessLogics;
using SportCompetitionsContracts.BusinessLogicsContracts;
using SportCompetitionsContracts.StoragesContracts;
namespace SportCompetitionsView
{
internal static class Program
{
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<Form1>());
}
private static void ConfigureServices(ServiceCollection services)
{
/*services.AddTransient<ICompetitionStorage, CompetitionStorage>();
services.AddTransient<IMemberStorage, MemberStorage>();
services.AddTransient<IRecordStorage, RecordStorage>();
services.AddTransient<IResultStorage, ResultStorage>();
services.AddTransient<ITeamStorage, TeamStorage>();*/
services.AddTransient<ICompetitionLogic, CompetitionLogic>();
services.AddTransient<IMemberLogic, MemberLogic>();
services.AddTransient<IRecordLogic, RecordLogic>();
services.AddTransient<IResultLogic, ResultLogic>();
services.AddTransient<ITeamLogic, TeamLogic>();
services.AddTransient<Form1>();
}
}
}