SUBD/CarRent/Program.cs

53 lines
1.9 KiB
C#
Raw Normal View History

using CarRentBusinessLogic.BusinessLogics;
using CarRentContracts.BusinessLogicContracts;
using CarRentContracts.StoragesContracts;
using CarRentDatabase.Implements;
using ClientRentBusinessLogic.BusinessLogics;
using Microsoft.Extensions.DependencyInjection;
using System;
namespace CarRent
{
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<FormRentals>());
}
private static void ConfigureServices(ServiceCollection services)
{
services.AddTransient<IBranchStorage, BranchStorage>();
services.AddTransient<ICarStorage, CarStorage>();
services.AddTransient<IRentalStorage, RentalStorage>();
services.AddTransient<IClientStorage, ClientStorage>();
services.AddTransient<IBranchLogic, BranchLogic>();
services.AddTransient<ICarLogic, CarLogic>();
services.AddTransient<IRentalLogic, RentalLogic>();
services.AddTransient<IClientLogic, ClientLogic>();
services.AddTransient<FormRentals>();
services.AddTransient<FormBranches>();
services.AddTransient<FormCars>();
services.AddTransient<FormClients>();
services.AddTransient<FormCreateRental>();
services.AddTransient<FormCreateBranch>();
services.AddTransient<FormCreateCar>();
services.AddTransient<FormCreateClient>();
services.AddTransient<FormAddReview>();
services.AddTransient<FormTests>();
}
}
}