本文整理汇总了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);
}
}
示例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();
}
}
示例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);
}
示例4: Configure
protected override void Configure(Configuration configuration)
{
configuration.UseSqlCommandScheduling();
sqlCommandScheduler = configuration.SqlCommandScheduler();
sqlCommandScheduler.GetClockName = e => clockName;
clockTrigger = sqlCommandScheduler;
clockRepository = sqlCommandScheduler;
configuration.TriggerSqlCommandSchedulerWithVirtualClock();
}