当前位置: 首页>>代码示例>>C#>>正文


C# Configuration.Repository方法代码示例

本文整理汇总了C#中Configuration.Repository方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.Repository方法的具体用法?C# Configuration.Repository怎么用?C# Configuration.Repository使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Configuration的用法示例。


在下文中一共展示了Configuration.Repository方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetUp

        public void SetUp()
        {
            // disable authorization
            Command<Order>.AuthorizeDefault = (o, c) => true;
            Command<CustomerAccount>.AuthorizeDefault = (o, c) => true;

            disposables = new CompositeDisposable
            {
                VirtualClock.Start()
            };

            customerAccountId = Any.Guid();

            configuration = new Configuration()
                .UseInMemoryCommandScheduling()
                .UseInMemoryEventStore();

            customerRepository = configuration.Repository<CustomerAccount>();
            orderRepository = configuration.Repository<Order>();

            customerRepository.Save(new CustomerAccount(customerAccountId).Apply(new ChangeEmailAddress(Any.Email())));

            disposables.Add(ConfigurationContext.Establish(configuration));
            disposables.Add(configuration);
        }
开发者ID:gitter-badger,项目名称:Its.Cqrs,代码行数:25,代码来源:CommandSchedulingTests.cs

示例2: SetUp

        public void SetUp()
        {
            clockName = Any.CamelCaseName();

            Clock.Reset();

            disposables = new CompositeDisposable
            {
                Disposable.Create(Clock.Reset)
            };

            var configuration = new Configuration()
                .UseSqlEventStore(c => c.UseConnectionString(TestDatabases.EventStore.ConnectionString))
                .UseSqlStorageForScheduledCommands(c => c.UseConnectionString(TestDatabases.CommandScheduler.ConnectionString));

            Configure(configuration);

            disposables.Add(ConfigurationContext.Establish(configuration));
            disposables.Add(configuration);

            orderRepository = configuration.Repository<Order>();
            accountRepository = configuration.Repository<CustomerAccount>();
            clockTrigger = configuration.SchedulerClockTrigger();
            clockRepository = configuration.SchedulerClockRepository();
            clockRepository.CreateClock(clockName, Clock.Now());
        }
开发者ID:charlesmccarthyirl,项目名称:Its.Cqrs,代码行数:26,代码来源:SqlCommandSchedulerTests_EventSourced.cs

示例3: SetUp

        public void SetUp()
        {
            disposables = new CompositeDisposable
            {
                VirtualClock.Start()
            };

            configuration = new Configuration()
                .UseInMemoryCommandScheduling()
                .UseInMemoryEventStore(traceEvents: true);

            playerRepo = configuration.Repository<MarcoPoloPlayerWhoIsNotIt>();
            itRepo = configuration.Repository<MarcoPoloPlayerWhoIsIt>();

            disposables.Add(ConfigurationContext.Establish(configuration));
            disposables.Add(configuration);
        }
开发者ID:gitter-badger,项目名称:Its.Cqrs,代码行数:17,代码来源:CommandSchedulerMessageExchangeTests.cs

示例4: CommandScheduler_executes_scheduled_commands_immediately_if_no_due_time_is_specified

        public async Task CommandScheduler_executes_scheduled_commands_immediately_if_no_due_time_is_specified()
        {
            // arrange
            var configuration = new Configuration()
                .UseInMemoryCommandScheduling()
                .UseInMemoryEventStore();

            var repository = configuration.Repository<Order>();

            var order = CreateOrder();

            // act
            order.Apply(new ShipOn(Clock.Now().Subtract(TimeSpan.FromDays(2))));
            await repository.Save(order);

            //assert 
            order = await repository.GetLatest(order.Id);
            var lastEvent = order.Events().Last();
            lastEvent.Should().BeOfType<Order.Shipped>();
        }
开发者ID:gitter-badger,项目名称:Its.Cqrs,代码行数:20,代码来源:CommandSchedulingTests.cs

示例5: Advancing_the_clock_blocks_until_triggered_commands_on_the_command_scheduler_are_completed

        public async Task Advancing_the_clock_blocks_until_triggered_commands_on_the_command_scheduler_are_completed()
        {
            VirtualClock.Start();

            var configuration = new Configuration()
                .UseInMemoryCommandScheduling()
                .UseInMemoryEventStore();

            var scheduler = configuration.CommandScheduler<Order>();
            var repository = configuration.Repository<Order>();

            var aggregateId = Any.Guid();
            await scheduler.Schedule(new CommandScheduled<Order>
            {
                Command = new CreateOrder(Any.FullName())
                {
                    AggregateId = aggregateId
                },
                DueTime = Clock.Now().AddHours(1),
                AggregateId = aggregateId
            });

            VirtualClock.Current.AdvanceBy(TimeSpan.FromDays(1));

            var order = await repository.GetLatest(aggregateId);

            order.Should().NotBeNull();
        }
开发者ID:commonsensesoftware,项目名称:Its.Cqrs,代码行数:28,代码来源:ClockTests.cs

示例6: ScheduleCommandAndAdvanceClock

        private static async Task ScheduleCommandAndAdvanceClock(Configuration configuration)
        {
            using (ConfigurationContext.Establish(configuration)) 
            using (VirtualClock.Start())
            {
                var scheduler = configuration.CommandScheduler<Order>();
                var repository = configuration.Repository<Order>();

                var aggregateId = Any.Guid();

                await scheduler.Schedule(new CommandScheduled<Order>
                {
                    Command = new CreateOrder(Any.FullName())
                    {
                        AggregateId = aggregateId
                    },
                    DueTime = Clock.Now().AddHours(1),
                    AggregateId = aggregateId
                });

                VirtualClock.Current.AdvanceBy(TimeSpan.FromDays(1));

                var order = await repository.GetLatest(aggregateId);

                order.Should().NotBeNull();
            }
        }
开发者ID:commonsensesoftware,项目名称:Its.Cqrs,代码行数:27,代码来源:ClockTests.cs


注:本文中的Configuration.Repository方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。