Example #1
0
 static Task Main(string[] args) =>
 // create console application with default settings
 ConsoleBuilder.CreateDefaultBuilder()
 // execute the app class on run
 .Execute <App>()
 // build the console app
 .Build()
 // run the app
 .Run(args);
Example #2
0
        static IConsole Build() =>
        ConsoleBuilder.CreateDefaultBuilder()
        .ConfigureServices((context, services) =>
        {
            var mapper   = new TypeMapper();
            var assembly = typeof(Program).Assembly;
            mapper.MapEventImplementations(assembly);
            mapper.MapAggregateImplementations(assembly);

            services.AddSingleton <ITypeMapper>(mapper);
            services.AddSingleton <IEventStore, EventStore>();
            services.AddTransient <IPendingEventFactory, PendingEventFactory>();
            services.AddTransient <IRepository <BankAccount>, Repository <BankAccount> >();
        })
        .Execute <App>()
        .Build();
Example #3
0
 static Task Main(string[] args) =>
 // create console application with default settings
 ConsoleBuilder.CreateDefaultBuilder()
 // configure dependency injection
 .ConfigureServices(services =>
 {
     // register ef core with dependency injection
     services.AddDbContext <ApplicationDbContext>(options => options.UseInMemoryDatabase("ApplicationDb"));
 })
 // execute the add users class on run
 .Execute <AddUsersFromConfiguration>()
 // execute the log users class on run
 .Execute <LogUsersInDatabase>()
 // build the console app
 .Build()
 // run the console app
 .Run(args);
Example #4
0
        static IConsole Build() =>
        ConsoleBuilder.CreateDefaultBuilder()
        .ConfigureServices((context, services) =>
        {
            services.AddTransient <IEventSerializer, JsonEventSerializer>();

            var mapper = new TypeMapper();
            mapper.MapEventImplementations(typeof(Program).Assembly);
            mapper.MapAggregateImplementations(typeof(Program).Assembly);

            services.AddSingleton <ITypeMapper>(mapper);
            services.AddDbContext <IEventStore, EventStore>(options => options.UseSqlServer(context.Configuration.GetConnectionString("EventStore")));
            services.AddTransient <IPendingEventFactory, PendingEventFactory>();
            services.AddTransient <IRepository <Order>, Repository <Order> >();
        })
        //.Execute<CreateOrders>()
        .Execute <TestOrder>()
        .Execute <TestThroughput>()
        //.Execute<LogEvents>()
        .Build();
Example #5
0
        static IConsole Build() =>
        ConsoleBuilder.CreateDefaultBuilder()
        .ConfigureServices((context, services) =>
        {
            services.AddTransient <IEventSerializer, JsonEventSerializer>();

            var mapper = new TypeMapper();
            mapper.MapEventImplementations(typeof(ShoppingCart).Assembly);
            mapper.MapAggregateImplementations(typeof(ShoppingCart).Assembly);

            services.AddSingleton(new EventStoreOptions()
            {
                ConnectionString = context.Configuration.GetConnectionString("EventStore")
            });
            services.AddSingleton <ITypeMapper>(mapper);
            services.AddTransient <IEventStore, EventStore>();
            services.AddSingleton <IEventReactor, EventReactor>();
        })
        //.Execute<LogLiveEventsReactively>()
        .Execute <LogLiveEventsByPolling>()
        .Build();
Example #6
0
        static IConsole Build() =>
        ConsoleBuilder.CreateDefaultBuilder()
        .ConfigureServices((context, services) =>
        {
            services.AddTransient <IEventSerializer, JsonEventSerializer>();

            var mapper = new TypeMapper();
            mapper.MapEventImplementations(typeof(Program).Assembly);
            mapper.MapAggregateImplementations(typeof(Program).Assembly);

            services.AddSingleton(new EventStoreOptions()
            {
                ConnectionString = context.Configuration.GetConnectionString("EventStore")
            });
            services.AddSingleton <ITypeMapper>(mapper);
            services.AddTransient <IEventStore, EventStore>();
            services.AddTransient <IPendingEventFactory, PendingEventFactory>();
            services.AddTransient <IRepository <ShoppingCart>, Repository <ShoppingCart> >();
        })
        .Execute <RepositoryThroughput>()
        .Execute <EventStoreThroughput>()
        .Build();
Example #7
0
        static IConsole Build() =>
        ConsoleBuilder.CreateDefaultBuilder()
        .ConfigureServices((context, services) =>
        {
            services.AddTransient <IEventSerializer, JsonEventSerializer>();

            var mapper = new TypeMapper();
            mapper.MapEventImplementations(typeof(Program).Assembly);
            mapper.MapAggregateImplementations(typeof(Program).Assembly);

            services.AddSingleton <ITypeMapper>(mapper);

            var connection = EventStoreConnection.Create(new IPEndPoint(IPAddress.Loopback, 1113));
            connection.ConnectAsync().Wait();

            services.AddSingleton(connection);

            services.AddTransient <IEventStore, EventSourcR.EventStore.EventStore>();
            services.AddTransient <IPendingEventFactory, PendingEventFactory>();
            services.AddTransient <IRepository <Ticket>, Repository <Ticket> >();
        })
        .Execute <TestThroughput>()
        .Build();