Ejemplo n.º 1
0
        public static async Task <int> Main(string[] args)
        {
            CompositeResolver.RegisterAndSetAsDefault(FSharpResolver.Instance, StandardResolver.Default);

            try
            {
                await BatchHost
                .CreateDefaultBuilder()
                .UseServiceProviderFactory <IUnityContainer>(new ServiceProviderFactory(new UnityContainer()))
                .ConfigureContainer <IUnityContainer>((hostContext, container) =>
                {
                    container.RegisterInstance <IMessageBroker>(Reactive.Bindings.Notifiers.MessageBroker.Default);
                    container.RegisterInstance <IUnityContainer>(container);

                    container.RegisterType <ICommandBus, CommandBus>();
                    container.RegisterType <I発送本DTOQuery, 発送本DTOQuery>();
                    container.RegisterType <I本を発送するCommand, 本を発送するCommand>();
                    container.RegisterType <I本を発送するCommandHandler, 本を発送するCommandHandler>();
                })
                .RunBatchEngineAsync <Scenario>(args);

                return(Environment.ExitCode);
            }
            catch (Exception ex) when((ex is ArgumentException) || (ex is ArgumentNullException))
            {
                Console.WriteLine(ex.Message);
                return(1);
            }
            catch (Exception)
            {
                return(9);
            }
        }
Ejemplo n.º 2
0
 static async Task Main(string[] args) => await BatchHost.CreateDefaultBuilder()
 .ConfigureServices((hostContext, services) =>
 {
     services.AddSingleton <IBuilder, Builder>();
     services.AddSingleton <ISettings, Settings>();
 })
 .RunBatchEngineAsync <UnityBuildRunnerBatch>(args);
Ejemplo n.º 3
0
 static async Task Main(string[] args)
 {
     await BatchHost.CreateDefaultBuilder()
     .ConfigureServices((hostContext, services) =>
     {
         // mapping config json to IOption<MyConfig>
         services.Configure <MyConfig>(hostContext.Configuration);
     })
     .RunBatchEngineAsync <MyFirstBatch>(args);
 }
Ejemplo n.º 4
0
        static async Task Main(string[] args)
        {
            args = @"-array [10,20,30] -person {""Age"":10,""Name"":""foo""}".Split(' ');

            await BatchHost.CreateDefaultBuilder()
            .ConfigureServices((hostContext, services) =>
            {
                // mapping config json to IOption<MyConfig>
                services.Configure <MyConfig>(hostContext.Configuration);
            })
            .RunBatchEngineAsync <ComplexArgTest>(args);
        }
Ejemplo n.º 5
0
 public static async Task Main(string[] args)
 {
     await BatchHost
     .CreateDefaultBuilder()
     .UseServiceProviderFactory <IUnityContainer>(new ServiceProviderFactory(new UnityContainer()))
     .ConfigureContainer <IUnityContainer>((hostContext, container) =>
     {
         container.RegisterType <I本Repository, DeliverySubDomain本Repository>();
         container.RegisterType <I本Factory, DeliverySubDomain本Factory>();
     })
     .RunBatchEngineAsync <Daemon>(args);
 }
Ejemplo n.º 6
0
        public static async Task <int> Main(string[] args)
        {
            try
            {
                await BatchHost
                .CreateDefaultBuilder()
                // .ConfigureServices((context, services) => { })
                .UseServiceProviderFactory <IUnityContainer>(new ServiceProviderFactory(new UnityContainer()))
                .ConfigureContainer <IUnityContainer>((hostContext, container) =>
                {
                    container.RegisterInstance <IMessageBroker>(Reactive.Bindings.Notifiers.MessageBroker.Default);
                    container.RegisterInstance <IUnityContainer>(container);
                    container.RegisterType <I書籍Factory, 書籍Factory>();
                    container.RegisterType <I本Factory, RentalSubDomain本Factory>();
                    container.RegisterType <I利用者Factory, 利用者Factory>();

                    container.RegisterType <CommandBus, CommandBus>();
                    container.RegisterFactory <ICommandBus>(c => new CommandBusDecorator(c.Resolve <CommandBus>()));
                    container.RegisterType <I利用者を登録するCommandHandler, 利用者を登録するCommandHandler>();
                    container.RegisterType <I利用者を登録するCommand, 利用者を登録するCommand>();
                    container.RegisterType <I本を登録するCommandHandler, 本を登録するCommandHandler>();
                    container.RegisterType <I本を登録するCommand, 本を登録するCommand>();
                    container.RegisterType <I本が登録されたEvent, 本が登録されたEvent>();
                    container.RegisterType <I本を登録する2CommandHandler, 本を登録する2CommandHandler>();
                    container.RegisterType <I本を登録する2Command, 本を登録する2Command>();
                    container.RegisterType <I本を借りるCommandHandler, 本を借りるCommandHandler>();
                    container.RegisterType <I本を借りるCommand, 本を借りるCommand>();
                    container.RegisterType <I本を延長するCommandHandler, 本を延長するCommandHandler>();
                    container.RegisterType <I本を延長するCommand, 本を延長するCommand>();
                    container.RegisterType <I本を返すCommandHandler, 本を返すCommandHandler>();
                    container.RegisterType <I本を返すCommand, 本を返すCommand>();
                    container.RegisterType <I本を破棄するCommandHandler, 本を破棄するCommandHandler>();
                    container.RegisterType <I本を破棄するCommand, 本を破棄するCommand>();

                    container.RegisterType <Iログイン情報Query, ログイン情報Query>();
                    container.RegisterType <I本の状況Query, 本の状況Query>();
                })
                .RunBatchEngineAsync <Scenario>(args);

                return(Environment.ExitCode);
            }
            catch (Exception ex) when((ex is ArgumentException) || (ex is ArgumentNullException))
            {
                Console.WriteLine(ex.Message);
                return(1);
            }
            catch (Exception)
            {
                return(9);
            }
        }
Ejemplo n.º 7
0
 static async Task Main(string[] args)
 {
     await BatchHost.CreateDefaultBuilder()
     .ConfigureServices((context, services) =>
     {
         services.AddHttpClient("agones", client =>
         {
             client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
         });
         services.AddSingleton <IAgonesSdk, AgonesSdk>();
         services.AddHostedService <AgonesHostedService>();
     })
     .RunBatchEngineAsync <EchoUdpServerBatch>(args);
 }
        public async Task TestCommandName()
        {
            var host = BatchHost.CreateDefaultBuilder()
                       .ConfigureServices((c, services) =>
            {
                services.AddSingleton <ResultContainer>();
            })
                       .UseBatchEngine <CommandAttributeTestCommand>(new string[] { "test", "-value", "1" })
                       .Build();
            var result = host.Services.GetService <ResultContainer>();
            await host.RunAsync();

            result.X.Should().Be(1);
        }
Ejemplo n.º 9
0
        public static async Task Main(string[] args)
        {
            CompositeResolver.RegisterAndSetAsDefault(FSharpResolver.Instance, StandardResolver.Default);

            await BatchHost
            .CreateDefaultBuilder()
            .UseServiceProviderFactory <IUnityContainer>(new ServiceProviderFactory(new UnityContainer()))
            .ConfigureContainer <IUnityContainer>((hostContext, container) =>
            {
                container.RegisterType <I本Repository, RentalSubDomain本Repository>();
                container.RegisterType <I書籍Repository, 書籍Repository>();
                container.RegisterType <I利用者Repository, 利用者Repository>();
                container.RegisterType <I利用者Factory, 利用者Factory>();
                container.RegisterType <I本Factory, RentalSubDomain本Factory>();
                container.RegisterType <I書籍Factory, 書籍Factory>();
            })
            .RunBatchEngineAsync <Daemon>(args);
        }
Ejemplo n.º 10
0
 private static async Task Main(string[] args)
 => await BatchHost.CreateDefaultBuilder().RunBatchEngineAsync <CreateEntityBatch>(args);
Ejemplo n.º 11
0
 static async Task Main(string[] args)
 {
     await BatchHost.CreateDefaultBuilder().RunBatchEngineAsync <Program>(args);
 }
Ejemplo n.º 12
0
 // C# 7.1(update lang version)
 static async Task Main(string[] args)
 {
     // you can use new HostBuilder() instead of CreateDefaultBuilder
     await BatchHost.CreateDefaultBuilder().RunBatchEngineAsync <MyFirstBatch>(args);
 }
Ejemplo n.º 13
0
 public static async Task Main(string[] args)
 {
     await BatchHost.CreateDefaultBuilder().RunBatchEngineAsync <GrpcClient>(args);
 }
Ejemplo n.º 14
0
 static async Task Main(string[] args)
 {
     await BatchHost.CreateDefaultBuilder().RunBatchEngineAsync <QueryToCSharp>(args);
 }
Ejemplo n.º 15
0
 static async Task Main(string[] args)
 {
     await BatchHost.CreateDefaultBuilder()
     .ConfigureServices((context, services) => services.AddHttpClient())
     .RunBatchEngineAsync <DnsResolution>(args);
 }
Ejemplo n.º 16
0
 static void Main(string[] args)
 {
     BatchHost.CreateDefaultBuilder().RunBatchEngineAsync <ExplorerBatch>(args);
 }
Ejemplo n.º 17
0
 static void Main(string[] args)
 => BatchHost.CreateDefaultBuilder()
 .RunBatchEngineAsync <GeneratorBatch>(args);
Ejemplo n.º 18
0
 private static async Task Main(string[] args)
 {
     await BatchHost.CreateDefaultBuilder().RunBatchEngineAsync <MessagepackCompiler>(args).ConfigureAwait(false);
 }
Ejemplo n.º 19
0
 static async Task Main(string[] args)
 => await BatchHost.CreateDefaultBuilder().RunBatchEngineAsync <PathMapBatch>(args);
Ejemplo n.º 20
0
 static async Task Main(string[] args)
 => await BatchHost.CreateDefaultBuilder()
 .RunBatchEngineAsync <QueryDivider>(args);
Ejemplo n.º 21
0
 /// <summary>
 /// Entry Point
 /// </summary>
 /// <param name="args">Command Line Args</param>
 static async Task Main(string[] args)
 {
     await BatchHost.CreateDefaultBuilder().RunBatchEngineAsync <TilHpGenerateBatch>(args);
 }