2023-11-29 18:00:55 +04:00
|
|
|
using LibraryBusinessLogic.BusinessLogics;
|
|
|
|
using LibraryContracts.BusinessLogicsContracts;
|
|
|
|
using LibraryContracts.StorageContracts;
|
|
|
|
using LibraryDatabaseImplement.Implements;
|
|
|
|
using Unity;
|
|
|
|
using Unity.Lifetime;
|
|
|
|
|
2023-09-21 21:56:08 +04:00
|
|
|
namespace LibraryView
|
|
|
|
{
|
2023-11-29 18:00:55 +04:00
|
|
|
public static class Program
|
2023-09-21 21:56:08 +04:00
|
|
|
{
|
2023-11-29 18:00:55 +04:00
|
|
|
private static IUnityContainer container = null;
|
|
|
|
public static IUnityContainer Container
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (container == null)
|
|
|
|
{
|
|
|
|
container = BuildUnityContainer();
|
|
|
|
}
|
|
|
|
return container;
|
|
|
|
}
|
|
|
|
}
|
2023-09-21 21:56:08 +04:00
|
|
|
/// <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.
|
2023-11-29 18:00:55 +04:00
|
|
|
Application.EnableVisualStyles();
|
|
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
|
|
Application.Run(Container.Resolve<FormMain>());
|
|
|
|
}
|
|
|
|
|
|
|
|
private static IUnityContainer BuildUnityContainer()
|
|
|
|
{
|
|
|
|
var currentContainer = new UnityContainer();
|
|
|
|
currentContainer.RegisterType<IBookStorage, BookStorage>(new HierarchicalLifetimeManager());
|
|
|
|
currentContainer.RegisterType<IBookLogic, BookLogic>(new HierarchicalLifetimeManager());
|
|
|
|
currentContainer.RegisterType<IGenreStorage, GenreStorage>(new HierarchicalLifetimeManager());
|
|
|
|
currentContainer.RegisterType<IGenreLogic, GenreLogic>(new HierarchicalLifetimeManager());
|
|
|
|
return currentContainer;
|
2023-09-21 21:56:08 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|