本文整理汇总了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);
}
示例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());
}
示例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);
}
示例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>();
}
示例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();
}
示例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();
}
}