SUBD_SportCompetitions/SportCompetitionsView/Program.cs

56 lines
1.9 KiB
C#
Raw Normal View History

2024-04-23 20:01:08 +04:00
using System;
using Microsoft.Extensions.DependencyInjection;
using SportCompetitionsBusinessLogic.BusinessLogics;
using SportCompetitionsContracts.BusinessLogicsContracts;
using SportCompetitionsContracts.StoragesContracts;
2024-04-23 22:13:09 +04:00
using SportCompetitionsDatabaseImplement.Implements;
2024-04-23 20:01:08 +04:00
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();
2024-04-23 22:13:09 +04:00
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
2024-04-23 20:01:08 +04:00
}
private static void ConfigureServices(ServiceCollection services)
{
2024-04-23 22:13:09 +04:00
services.AddTransient<ICompetitionStorage, CompetitionStorage>();
2024-04-23 20:01:08 +04:00
services.AddTransient<IMemberStorage, MemberStorage>();
services.AddTransient<IRecordStorage, RecordStorage>();
services.AddTransient<IResultStorage, ResultStorage>();
2024-04-23 22:13:09 +04:00
services.AddTransient<ITeamStorage, TeamStorage>();
2024-04-23 20:01:08 +04:00
services.AddTransient<ICompetitionLogic, CompetitionLogic>();
services.AddTransient<IMemberLogic, MemberLogic>();
services.AddTransient<IRecordLogic, RecordLogic>();
services.AddTransient<IResultLogic, ResultLogic>();
services.AddTransient<ITeamLogic, TeamLogic>();
2024-04-23 22:13:09 +04:00
services.AddTransient<FormMain>();
2024-04-23 22:13:09 +04:00
services.AddTransient<FormMember>();
services.AddTransient<FormMembers>();
2024-04-23 22:13:09 +04:00
services.AddTransient<FormCompetition>();
services.AddTransient<FormCompetitions>();
2024-04-23 20:01:08 +04:00
2024-04-23 22:25:40 +04:00
services.AddTransient<FormTeam>();
services.AddTransient<FormTeams>();
2024-04-23 20:01:08 +04:00
}
}
}