protected override ServiceHost CreateInjectedServiceHost
            (Container container, Type serviceType, Uri[] baseAddresses)
        {
            ServiceHost serviceHost = new SimpleInjectorServiceHost
                                          (container, serviceType, baseAddresses);

            return(serviceHost);
        }
Esempio n. 2
0
 private static void HostServices()
 {
     _container = new Container();
     _container.Register <FinancialForecastingContext>();
     _container.Verify();
     _host = new SimpleInjectorServiceHost(_container, typeof(MigrationService));
     _host.Open();
 }
Esempio n. 3
0
        static void StopService(SimpleInjectorServiceHost host, string serviceDescription)
        {
            host.Close();
            Console.WriteLine($"Service { serviceDescription } stopped");


            Console.WriteLine();
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            var container = IocContainer.Init();

            SM.ServiceHost hostService = new SimpleInjectorServiceHost(container, typeof(Service1));
            hostService.Open();

            System.Console.ReadLine();

            hostService.Close();
        }
Esempio n. 5
0
        static void StartService(SimpleInjectorServiceHost host, string serviceDescription)
        {
            host.Open();
            Console.WriteLine($"Service { serviceDescription } started");

            foreach (var endPoint in host.Description.Endpoints)
            {
                Console.WriteLine("Listening on endpoint:");
                Console.WriteLine($"Address: { endPoint.Address.Uri }");
                Console.WriteLine($"Binding: { endPoint.Binding.Name }");
                Console.WriteLine($"Contract: { endPoint.Contract.Name }");
            }
            Console.WriteLine();
        }
        static void Main(string[] args)
        {
            var container = InitializeContainer();

            //reserve url: netsh http add urlacl url = http://+:8086/ user="******"
            ServiceHost serviceHost = new SimpleInjectorServiceHost(container, typeof(ScreenManager));

            serviceHost.Open();

            ServiceHost serviceHostProfile = new SimpleInjectorServiceHost(container, typeof(ProfileManager));

            serviceHostProfile.Open();

            Console.WriteLine("Services started. Press [Enter] to exit.");
            Console.ReadLine();

            serviceHost.Close();
            serviceHostProfile.Close();
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            // Create the container as usual.
            var container = new Container();

            container.Options.DefaultScopedLifestyle = new WcfOperationLifestyle();

            // Register your types, for instance:
            DataBootStraper.BootStrap(container);

            container.Register <IRelationshipGroupService, RelationshipGroupManager>();

            // Register the container to the SimpleInjectorServiceHostFactory.
            SimpleInjectorServiceHostFactory.SetContainer(container);

            Console.WriteLine("Starting up services...");
            Console.WriteLine("");

            //SM.ServiceHost host = new SM.ServiceHost(typeof(RelationshipGroupManager));

            var hostRelationshipGroupManager = new SimpleInjectorServiceHost(container, typeof(RelationshipGroupManager), new Uri[0]);
            var hostLifeEventManager         = new SimpleInjectorServiceHost(container, typeof(LifeEventManager), new Uri[0]);


            StartService(hostRelationshipGroupManager, "Relationship Group");
            StartService(hostLifeEventManager, " LifeEvents ");

            Console.WriteLine("");
            Console.WriteLine("Press [Enter] to exit.");
            Console.ReadLine();

            StopService(hostRelationshipGroupManager, "Relationship Group");
            StopService(hostLifeEventManager, "LifeEvents");

            Console.ReadLine();
        }
Esempio n. 8
0
        static void Main(string[] args)
        {
            //using (ServiceHost host = new ServiceHost(typeof(QIQO.Business.Services.AccountService)))
            //{
            //    host.Open();
            //    Console.WriteLine("Account Service Started @ " + DateTime.Now.ToString());
            //    Console.ReadLine();
            //    host.Close();
            //}

            //Logger logr = new Logger("QIQO.Common.Core");
            Log.Info("Starting the application...");
            IocContainer.Container = IocLoader.Init();

            //using (IUnityContainer container = new UnityContainer())
            using (IocContainer.Container)
            {
                //RegisterTypes(container);
                //IocContainer.Container = container;

                // Step 1 Create a URI to serve as the base address.
                //Uri baseAddress = new Uri("net.tcp://*****:*****@ " + DateTime.Now.ToString());
                    //    Console.ReadLine();
                    //    hostAccountService.Close();
                    //    Log.Info("Account Service stopped @ " + DateTime.Now.ToString());
                    //}

                    StartService(hostAccountService, "Account Service");
                    StartService(hostAddressService, "Address Service");
                    StartService(hostAuditService, "Audit Service");
                    StartService(hostCompanyService, "Company Service");
                    StartService(hostEmployeeService, "Employee Service");
                    StartService(hostEntityProductService, "Entity Product Service");
                    StartService(hostFeeScheduleService, "Fee Schedule Service");
                    StartService(hostInvoiceService, "Invoice Service");
                    StartService(hostLedgerService, "Ledger Service");
                    StartService(hostOrderService, "Order Service");
                    StartService(hostProductService, "Product Service");
                    StartService(hostSessionService, "Session Service");
                    StartService(hostTypeService, "Type Service");
                    StartService(hostIdentityUserService, "Identity User Service");
                    StartService(hostIdentityRoleService, "Identity Role Service");


                    Console.WriteLine("");
                    Console.WriteLine("Press [Enter] to exit.");
                    Console.ReadLine();
                    Console.WriteLine("");

                    StopService(hostAccountService, "Account Service");
                    StopService(hostAddressService, "Address Service");
                    StopService(hostAuditService, "Audit Service");
                    StopService(hostCompanyService, "Company Service");
                    StopService(hostEmployeeService, "Employee Service");
                    StopService(hostEntityProductService, "Entity Product Service");
                    StopService(hostFeeScheduleService, "Fee Schedule Service");
                    StopService(hostInvoiceService, "Invoice Service");
                    StopService(hostLedgerService, "Ledger Service");
                    StopService(hostOrderService, "Order Service");
                    StopService(hostProductService, "Product Service");
                    StopService(hostSessionService, "Session Service");
                    StopService(hostTypeService, "Type Service");
                    StopService(hostIdentityUserService, "Identity User Service");
                    StopService(hostIdentityRoleService, "Identity Role Service");
                }
                catch (SM.CommunicationException ce)
                {
                    Log.Error("An exception occurred: {0}", ce.Message);
                }
                catch (Exception ex)
                {
                    Log.Error("An exception occurred: {0}", ex.Message);
                }
                finally
                {
                    hostAccountService.Abort();
                    hostAddressService.Abort();
                    hostAuditService.Abort();
                    hostCompanyService.Abort();
                    hostEmployeeService.Abort();
                    hostEntityProductService.Abort();
                    hostFeeScheduleService.Abort();
                    hostInvoiceService.Abort();
                    hostLedgerService.Abort();
                    hostOrderService.Abort();
                    hostProductService.Abort();
                    hostSessionService.Abort();
                    hostTypeService.Abort();
                    hostIdentityUserService.Abort();
                    hostIdentityRoleService.Abort();
                }
            }
        }