ПИбд-23 Ладягин П.Д. Первая л.р. #1

Open
F1rsTTeaM wants to merge 20 commits from LabWork01 into main
2 changed files with 23 additions and 1 deletions
Showing only changes of commit 99d1bee2ed - Show all commits

View File

@ -8,4 +8,8 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Unity" Version="5.11.10" />
</ItemGroup>
</Project>

View File

@ -1,3 +1,7 @@
using FuelAndLubricants.Repositories;
using FuelAndLubricants.Repositories.Implementations;
using Unity;
namespace FuelAndLubricants
{
internal static class Program
@ -11,7 +15,21 @@ namespace FuelAndLubricants
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
Application.Run(CreateContainer().Resolve<Form1>());
}
private static UnityContainer CreateContainer()
{
var container = new UnityContainer();
container.RegisterType<ICarRepository, CarRepository>();
container.RegisterType<IDriverRepository, DriverRepository>();
container.RegisterType<IFuelRepository, FuelRepository>();
container.RegisterType<IRefillRepository, RefillRepository>();
container.RegisterType<IRouteRepository, RouteRepository>();
container.RegisterType<ITripRepository, TripRepository>();
return container;
}
}
}