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


C# Configuration.CommandScheduler方法代码示例

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


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

示例1: Configuration

        public void Once_SqlCommandScheduler_is_resolved_from_the_Configuration_then_aggregate_specific_command_schedulers_are_registered()
        {
            var configuration = new Configuration()
                .UseDependency<GetClockName>(c => e => SqlCommandScheduler.DefaultClockName)
                .UseInMemoryEventStore();
            configuration.Container.Resolve<SqlCommandScheduler>();

            var commandScheduler = configuration.CommandScheduler<Order>();

            commandScheduler.Should()
                            .NotBeNull();
            configuration.CommandScheduler<Order>()
                         .Should()
                         .BeSameAs(commandScheduler);
        }
开发者ID:commonsensesoftware,项目名称:Its.Cqrs,代码行数:15,代码来源:SqlCommandSchedulerTests_Legacy.cs

示例2: SetUp

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

            clockName = Any.CamelCaseName();
            targetId = Any.Word();
            target = new CommandTarget(targetId);
            store = new InMemoryStore<CommandTarget>(
                _ => _.Id,
                id => new CommandTarget(id))
            {
                target
            };

            configuration = new Configuration()
                .UseInMemoryCommandScheduling()
                .UseDependency<IStore<CommandTarget>>(_ => store)
                .UseDependency<GetClockName>(c => _ => clockName)
                .TraceScheduledCommands();

            scheduler = configuration.CommandScheduler<CommandTarget>();

            Command<CommandTarget>.AuthorizeDefault = (commandTarget, command) => true;

            disposables.Add(ConfigurationContext.Establish(configuration));
            disposables.Add(configuration);
        }
开发者ID:charlesmccarthyirl,项目名称:Its.Cqrs,代码行数:30,代码来源:NonEventSourcedAggregateCommandSchedulingTests.cs

示例3: SetUp

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

            clockName = Any.CamelCaseName();
            targetId = Any.Word();
            target = new CommandTarget(targetId);
            store = new InMemoryStore<CommandTarget>(
                _ => _.Id,
                id => new CommandTarget(id))
            {
                target
            };

            CommandSchedulerDbContext.NameOrConnectionString =
                @"Data Source=(localdb)\MSSQLLocalDB; Integrated Security=True; MultipleActiveResultSets=False; Initial Catalog=ItsCqrsTestsCommandScheduler";

            configuration = new Configuration()
                .UseInMemoryCommandScheduling()
                .UseDependency<IStore<CommandTarget>>(_ => store)
                .UseDependency<GetClockName>(c => _ => clockName)
                .TraceScheduledCommands();

            scheduler = configuration.CommandScheduler<CommandTarget>();

            Command<CommandTarget>.AuthorizeDefault = (commandTarget, command) => true;

            disposables.Add(ConfigurationContext.Establish(configuration));
            disposables.Add(configuration);
        }
开发者ID:PhillipPruett,项目名称:Its.Cqrs,代码行数:33,代码来源:NonEventSourcedAggregateCommandSchedulingTests.cs

示例4: Configure

        protected override void Configure(Configuration configuration)
        {
            disposables = new CompositeDisposable();
            clockName = Any.CamelCaseName();

            configuration.UseSqlStorageForScheduledCommands()
                         .UseInMemoryCommandTargetStore()
                         .TraceScheduledCommands()
                         .UseDependency<GetClockName>(_ => command => clockName);

            scheduler = configuration.CommandScheduler<CommandTarget>();

            store = configuration.Store<CommandTarget>();
        }
开发者ID:PhillipPruett,项目名称:Its.Cqrs,代码行数:14,代码来源:SqlCommandSchedulerTests_NonEventSourced.cs

示例5: CommandSchedulerPipeline_can_be_used_to_specify_command_scheduler_behavior_on_schedule

        public async Task CommandSchedulerPipeline_can_be_used_to_specify_command_scheduler_behavior_on_schedule()
        {
            var scheduled = false;
            var configuration = new Configuration()
                .UseInMemoryEventStore()
                .AddToCommandSchedulerPipeline<Order>(
                    schedule: async (cmd, next) => { scheduled = true; });

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

            await scheduler.Schedule(Any.Guid(), new CreateOrder(Any.FullName()));

            scheduled.Should().BeTrue();
        }
开发者ID:gitter-badger,项目名称:Its.Cqrs,代码行数:14,代码来源:CommandSchedulingTests.cs

示例6: 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

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