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


C# CommandProcessor.Execute方法代码示例

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


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

示例1: Main

        public static void Main()
        {
            // we can create a singleton instance of the command processor. each execution can occur concurrently
            // and has it's own state.
            var processorSingleton = new CommandProcessor(DemoAPICommandProcessorConfiguration.Instance);

            // command with return value - 1 transaction per command
            int id = processorSingleton.Execute(new AddProductModel()
            {
                // ... properties ...
            });

            // command with no return value - 1 transaction per command
            processorSingleton.Execute(new SetProductModelName()
            {
                // ... properties ...
            });

            processorSingleton.Execute(new AddProductReview()
            {
                ProductId = 316,

                ReviewerName = "Joseph Daigle",
                EmailAddress = "[email protected]",
                Rating = 4,
                Comments = "Meh",
            });
        }
开发者ID:jdaigle,项目名称:CQRSPipelineDemo,代码行数:28,代码来源:Program.cs

示例2: ExecuteQuery

 private static void ExecuteQuery(CommandProcessor commandProcessor)
 {
     Console.WriteLine("Executing query");
     var query = new SayHelloQuery("Dan");
     commandProcessor.Execute(query).Wait();
     Console.WriteLine(query.Result);
 }
开发者ID:DannyRyman,项目名称:CommandProcessor,代码行数:7,代码来源:Program.cs

示例3: ExecuteWithNullCommandThrowsArgumentNullException

        public void ExecuteWithNullCommandThrowsArgumentNullException()
        {
            var serviceProviderMock = new Mock<IServiceProvider>(MockBehavior.Strict);

            var sut = new CommandProcessor(serviceProviderMock.Object);

            TestCommand command = null;

            var ex = Assert.Throws<ArgumentNullException>(() => sut.Execute(command));

            Assert.Equal("command", ex.ParamName);
        }
开发者ID:Georadix,项目名称:Georadix.NET,代码行数:12,代码来源:CommandProcessorFixture.cs

示例4: ExecuteWithValidCommandExecutesCommand

        public void ExecuteWithValidCommandExecutesCommand()
        {
            var serviceProviderMock = new Mock<IServiceProvider>(MockBehavior.Strict);
            var commandHandlerMock = new Mock<ICommandHandler<TestCommand>>(MockBehavior.Strict);

            var sut = new CommandProcessor(serviceProviderMock.Object);

            var command = new TestCommand();

            serviceProviderMock
                .Setup(sp => sp.GetService(typeof(ICommandHandler<TestCommand>)))
                .Returns(commandHandlerMock.Object);

            commandHandlerMock.Setup(ch => ch.Handle(command));

            sut.Execute(command);

            serviceProviderMock.VerifyAll();
            commandHandlerMock.VerifyAll();
        }
开发者ID:Georadix,项目名称:Georadix.NET,代码行数:20,代码来源:CommandProcessorFixture.cs

示例5: ExecuteCommand

 private static void ExecuteCommand(CommandProcessor commandProcessor)
 {
     Console.WriteLine("Executing command");
     var command = new SayHelloCommand("Dan");
     commandProcessor.Execute(command).Wait();
 }
开发者ID:DannyRyman,项目名称:CommandProcessor,代码行数:6,代码来源:Program.cs


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