static void Main(string[] args) { GenericPrincipal principal = new GenericPrincipal( new GenericIdentity("Admin"), new string[] { "AlbumAppAdmin" }); Thread.CurrentPrincipal = principal; Console.WriteLine("Starting up services ..."); Console.WriteLine(""); ObjectBase.Container = AutoFacLoader.Init(); AutofacHostFactory.Container = AutoFacLoader.Init(); using (var container = AutofacHostFactory.Container) // ObjectBase.Container { SM.ServiceHost hostAccountManager = new SM.ServiceHost(typeof(AccountManager)); SM.ServiceHost hostInventoryManager = new SM.ServiceHost(typeof(InventoryManager)); SM.ServiceHost hostCartManager = new SM.ServiceHost(typeof(CartManager)); SM.ServiceHost hostOrderManager = new SM.ServiceHost(typeof(OrderManager)); StartService(hostAccountManager, "AccountManager"); StartService(hostInventoryManager, "InventoryManager"); StartService(hostCartManager, "CartManager"); StartService(hostOrderManager, "OrderManager"); _cartManager = container.Resolve <CartManager>(); System.Timers.Timer timer = new System.Timers.Timer(60000); timer.Elapsed += OnTimerElapsed; timer.Start(); Console.WriteLine("Cart Item monitor started."); Console.WriteLine(""); Console.WriteLine("Press [Enter] to exit."); Console.ReadLine(); timer.Stop(); Console.WriteLine("Cart Item monitor stopped."); StopService(hostAccountManager, "AccountManager"); StopService(hostInventoryManager, "InventoryManager"); StopService(hostCartManager, "CartManager"); StopService(hostOrderManager, "OrderManager"); } }
public ProxyObtainmentTests() { ObjectBase.Container = AutoFacLoader.Init(); } //builder.Build();
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); ObjectBase.Container = AutoFacLoader.Init(); }