protected void CreateOpenDisconnectedHost(Type contractType)
        {
            host = new DynamicHost(contractType, container);

            host.CreateDisconnectedHost();

            host.Open();
        }
        protected void CreateOpenConnectedHost(Type contractType)
        {
            arbitaryPort = new Random(5000).Next(5000, 7000);

            host = new DynamicHost(contractType, container);

            host.CreateConnectedHost(arbitaryPort);

            host.Open();
        }
        public static ServiceHost HostQueries(List <Type> queryTypes,
                                              ModuleBuilder moduleBuilder,
                                              IHostContainer container,
                                              ILogger logger)
        {
            var hostList = new List <DynamicHost>();

            foreach (var serviceType in queryTypes)
            {
                var host = new DynamicHost(serviceType, container /*, moduleBuilder: moduleBuilder*/);

                host.CreateConnectedHost(isTransactional: false);

                host.Open();

                logger.Log($"Connected service hosted for: {serviceType.FullName}", LogLevel.Normal);

                hostList.Add(host);
            }

            return(new ServiceHost(hostList));
        }
        public static ServiceHost HostCommands(List <Type> serviceTypes,
                                               ModuleBuilder moduleBuilder,
                                               IHostContainer hostContainer,
                                               ILogger logger)
        {
            var hostList = new List <DynamicHost>();

            foreach (var serviceType in serviceTypes)
            {
                var host = new DynamicHost(serviceType, hostContainer /*, moduleBuilder: moduleBuilder*/);

                host.CreateConnectedHost(null);
                host.CreateDisconnectedHost();

                host.Open();

                logger.Log($"Connected and disconnected services hosted for: {serviceType.FullName}", LogLevel.Normal);

                hostList.Add(host);
            }

            return(new ServiceHost(hostList));
        }