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


C# ServiceController.Execute方法代码示例

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


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

示例1: Can_execute_BasicService

        public void Can_execute_BasicService()
        {
            var serviceController = new ServiceController();

            serviceController.Register(() => new BasicService());
            var result = serviceController.Execute(new BasicRequest()) as BasicRequestResponse;

            Assert.That(result, Is.Not.Null);
        }
开发者ID:Braunson,项目名称:ServiceStack,代码行数:9,代码来源:ServiceHostTests.cs

示例2: With_Expressions

        public void With_Expressions()
        {
            var requestType = typeof(BasicRequest);
            var serviceController = new ServiceController();

            serviceController.Register(requestType, typeof(BasicService));
            var request = new BasicRequest();

            Console.WriteLine("With_Expressions(): {0}", Measure(() => serviceController.Execute(request), Times));
        }
开发者ID:EvgeniyProtas,项目名称:servicestack,代码行数:10,代码来源:PerfTests.cs

示例3: Can_execute_RestTestService

        public void Can_execute_RestTestService()
        {
            var serviceController = new ServiceController();

            serviceController.Register(() => new RestTestService());
            var result = serviceController.Execute(new RestTest()) as RestTestResponse;

            Assert.That(result, Is.Not.Null);
            Assert.That(result.MethodName, Is.EqualTo("Execute"));
        }
开发者ID:Wolfium,项目名称:ServiceStack-1,代码行数:10,代码来源:ServiceHostTests.cs

示例4: NativeFunq_Perf

        public void NativeFunq_Perf()
        {
            var serviceController = new ServiceController();

            RegisterServices(serviceController, GetNativeFunqTypeFactory());

            StoreAndGetCustomers(serviceController);

            var request = new GetCustomer { CustomerId = 2 };
            Console.WriteLine("NativeFunq_Perf(): {0}", Measure(() => serviceController.Execute(request), Times));
        }
开发者ID:EvgeniyProtas,项目名称:servicestack,代码行数:11,代码来源:CustomerUseCase.cs

示例5: Can_execute_BasicService_from_dynamic_Type

        public void Can_execute_BasicService_from_dynamic_Type()
        {
            var requestType = typeof(BasicRequest);

            var serviceController = new ServiceController();
            serviceController.Register(requestType, typeof(BasicService));

            object request = Activator.CreateInstance(requestType);

            var result = serviceController.Execute(request) as BasicRequestResponse;

            Assert.That(result, Is.Not.Null);
        }
开发者ID:Braunson,项目名称:ServiceStack,代码行数:13,代码来源:ServiceHostTests.cs

示例6: StoreAndGetCustomers

        private static void StoreAndGetCustomers(ServiceController serviceController)
        {
            var storeCustomers = new StoreCustomers {
                Customers = {
                    new Customer { Id = 1, FirstName = "First", LastName = "Customer" },
                    new Customer { Id = 2, FirstName = "Second", LastName = "Customer" },
                }
            };
            serviceController.Execute(storeCustomers);

            storeCustomers = new StoreCustomers {
                Customers = {
                    new Customer {Id = 3, FirstName = "Third", LastName = "Customer"},
                }
            };
            serviceController.Execute(storeCustomers);

            var response = serviceController.Execute(new GetCustomer { CustomerId = 2 });

            Assert.That(response as GetCustomerResponse, Is.Not.Null);

            var customer = ((GetCustomerResponse)response).Customer;
            Assert.That(customer.FirstName, Is.EqualTo("Second"));
        }
开发者ID:namman,项目名称:ServiceStack,代码行数:24,代码来源:CustomerUseCase.cs

示例7: Can_RestTestService_DELETE

        public void Can_RestTestService_DELETE()
        {
            var serviceController = new ServiceController();

            serviceController.Register(() => new RestTestService());
            var result = serviceController.Execute(new RestTest(),
                new HttpRequestContext((object)null, EndpointAttributes.HttpDelete)) as RestTestResponse;

            Assert.That(result, Is.Not.Null);
            Assert.That(result.MethodName, Is.EqualTo("Delete"));
        }
开发者ID:Braunson,项目名称:ServiceStack,代码行数:11,代码来源:ServiceHostTests.cs

示例8: With_TypedArguments

        public void With_TypedArguments()
        {
            var serviceController = new ServiceController();

            serviceController.Register(() => new BasicService());
            var request = new BasicRequest();

            Console.WriteLine("With_TypedArguments(): {0}", Measure(() => serviceController.Execute(request), Times));
        }
开发者ID:EvgeniyProtas,项目名称:servicestack,代码行数:9,代码来源:PerfTests.cs


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