PIbd-31_Belianin.N.N_COP_8/Lab 4/Belianin_4/DesktopWithMyVisualComponents/Program.cs
2024-10-23 17:38:42 +04:00

50 lines
1.4 KiB
C#

using EnterpriseBusinessLogic.BusinessLogics;
using EnterpriseContracts.BusinessLogicContracts;
using EnterpriseContracts.StorageContracts;
using EnterpriseDataBaseImplement.Implements;
using Unity;
using Unity.Lifetime;
namespace DesktopWithMyVisualComponents
{
internal static class Program
{
private static IUnityContainer container = null;
public static IUnityContainer Container
{
get
{
if (container == null)
{
container = BuildUnityContainer();
}
return container;
}
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(Container.Resolve<FormMain>());
}
private static IUnityContainer BuildUnityContainer()
{
var currentContainer = new UnityContainer();
currentContainer.RegisterType<IEmployeeStorage, EmployeeStorage>(new HierarchicalLifetimeManager());
currentContainer.RegisterType<ISkillStorage, SkillStorage>(new HierarchicalLifetimeManager());
currentContainer.RegisterType<IEmployeeLogic, EmployeeLogic>(new HierarchicalLifetimeManager());
currentContainer.RegisterType<ISkillLogic, SkillLogic>(new HierarchicalLifetimeManager());
return currentContainer;
}
}
}