Пример #1
0
        public static void Run(IEnumerable <string> args)
        {
            var container = ContainerBootstrapper.BootstrapStructureMap();

            var application = container.GetInstance <ConsoleApplication>();

            application.SetArguments(args);
            application.Run();
        }
Пример #2
0
        public static void Main(string[] args)
        {
            ContainerBootstrapper.BootstrapStructureMap();
            string serviceBaseURI         = ConfigurationManager.AppSettings["ServiceBaseURI"];
            string batchingServiceBaseURI = ConfigurationManager.AppSettings["BatchingServiceBaseURI"];

            // Build and start the Regular Service.
            using (var host = new ServiceHost(typeof(GitHubSoapService), new Uri(serviceBaseURI)))
            {
                host.AddServiceEndpoint(typeof(IGitHubSoapService), new BasicHttpBinding(), "GitHubSoap");

                host.Description.Behaviors.Add(new AuthenticationHeaderBehavior());
                host.Description.Behaviors.Add(new RequestCallRateBehavior());
                host.Description.Behaviors.Add(new ServiceMetadataBehavior
                {
                    HttpGetEnabled = true,
                    HttpGetUrl     = new Uri(serviceBaseURI + "/GitHubSoap/metadata")
                });

                host.Authorization.ServiceAuthorizationManager = new CustomAuthorizationManager();
                host.Open();
                Console.WriteLine("Regular Host is opened, press any key to end ...");

                // Build and start the Batching Service.
                using (var batchingHost = new ServiceHost(typeof(GitHubSoapBatchingService), new Uri(batchingServiceBaseURI)))
                {
                    batchingHost.AddServiceEndpoint(typeof(IGitHubSoapBatchingService), new BasicHttpBinding(), "GitHubSoapBatching");

                    batchingHost.Description.Behaviors.Add(new ServiceMetadataBehavior
                    {
                        HttpGetEnabled = true,
                        HttpGetUrl     = new Uri(batchingServiceBaseURI + "/GitHubSoapBatching/metadata")
                    });

                    batchingHost.Open();
                    Console.WriteLine("Batching Host is opened, press any key to end ...");
                    Console.ReadKey();
                }
            }
        }
Пример #3
0
        private static void Main(string[] args)
        {
            ContainerBootstrapper.BootstrapStructureMap(args);

            IContainer           container    = ObjectFactory.Container;
            IList <ITaskManager> taskManagers = container.GetAllInstances <ITaskManager>();

            if (ShouldUsageBeShown(args))
            {
                ShowUsage(taskManagers);
                return;
            }

            var argumentParser = ObjectFactory.GetInstance <IArgumentParser>();
            var optionParser   = ObjectFactory.GetInstance <IOptionsParser>();

            ITaskBuilder taskBuilder = new TaskBuilder(args, argumentParser, optionParser);
            ITaskDTO     taskDto     = taskBuilder.CreateTask();
            bool         taskCreated = false;

            ITaskManager taskManagerToRun = ProviderMatcher.GetMatchingTaskManager(args, taskManagers);

            taskManagerToRun.CreateTask(taskDto);
        }
 public RESTBlogsService()
 {
     this.serviceURI = ConfigurationManager.AppSettings["ServiceURI"];
     ContainerBootstrapper.BootstrapStructureMap();
 }
 public void FixtureSetup()
 {
     container = ContainerBootstrapper.BootstrapStructureMap();
 }