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


C# Configuration.SqlCommandScheduler方法代码示例

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


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

示例1: UseSqlCommandScheduling_can_include_using_a_catchup_for_durability

        public async Task UseSqlCommandScheduling_can_include_using_a_catchup_for_durability()
        {
            var configuration = new Configuration()
                .UseSqlEventStore()
                .UseSqlCommandScheduling(catchup => catchup.StartAtEventId = eventStoreDbTest.HighestEventId);
            configuration.SqlCommandScheduler().GetClockName = e => clockName;
            disposables.Add(configuration);

            var aggregateIds = Enumerable.Range(1, 5).Select(_ => Any.Guid()).ToArray();

            Events.Write(5, i => new CommandScheduled<Order>
            {
                Command = new CreateOrder(Any.FullName()),
                AggregateId = aggregateIds[i - 1],
                SequenceNumber = -DateTimeOffset.UtcNow.Ticks
            });

            await configuration.Container
                               .Resolve<ReadModelCatchup<CommandSchedulerDbContext>>()
                               .SingleBatchAsync();

            using (var db = new CommandSchedulerDbContext())
            {
                var scheduledAggregateIds = db.ScheduledCommands
                                              .Where(c => aggregateIds.Any(id => id == c.AggregateId))
                                              .Select(c => c.AggregateId)
                                              .ToArray();

                scheduledAggregateIds.Should()
                                     .BeEquivalentTo(aggregateIds);
            }
        }
开发者ID:gitter-badger,项目名称:Its.Cqrs,代码行数:32,代码来源:SqlCommandSchedulerTests.cs

示例2: Advancing_the_clock_blocks_until_triggered_commands_on_the_SqlCommandScheduler_are_completed

        public async Task Advancing_the_clock_blocks_until_triggered_commands_on_the_SqlCommandScheduler_are_completed()
        {
            var configuration = new Configuration()
                .UseInMemoryEventStore()
                .UseSqlCommandScheduling()
                .TriggerSqlCommandSchedulerWithVirtualClock();

            VirtualClock.Start();

            configuration.SqlCommandScheduler()
                         .GetClockName = e => Any.CamelCaseName();

            using (ConfigurationContext.Establish(configuration))
            {
                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:gitter-badger,项目名称:Its.Cqrs,代码行数:36,代码来源:ClockTests.cs

示例3: Configuration

        public async Task When_using_legacy_SQL_command_scheduling_then_advancing_the_clock_blocks_until_triggered_commands_are_completed()
        {
            var configuration = new Configuration()
                .UseInMemoryEventStore()
                .UseSqlCommandScheduling()
                .TriggerSqlCommandSchedulerWithVirtualClock();

            configuration.SqlCommandScheduler()
                         .GetClockName = e => Any.CamelCaseName();

            await ScheduleCommandAndAdvanceClock(configuration);
        }
开发者ID:commonsensesoftware,项目名称:Its.Cqrs,代码行数:12,代码来源:ClockTests.cs

示例4: Configure

 protected override void Configure(Configuration configuration)
 {
     configuration.UseSqlCommandScheduling();
     sqlCommandScheduler = configuration.SqlCommandScheduler();
     sqlCommandScheduler.GetClockName = e => clockName;
     clockTrigger = sqlCommandScheduler;
     clockRepository = sqlCommandScheduler;
     configuration.TriggerSqlCommandSchedulerWithVirtualClock();
 }
开发者ID:commonsensesoftware,项目名称:Its.Cqrs,代码行数:9,代码来源:SqlCommandSchedulerTests_Legacy.cs


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