小编Mar*_*son的帖子

Assembly.GetTypes()用于嵌套类

Assmbly.GetTpes()获取程序集中的类型,但如果我还想要嵌套类(OrderLine),我该怎么做?我只知道程序集的名称,而不是类名,因此GetType(Order + OrderLine)不起作用.

public class Order
{
  public class OrderLine
  {
  }
}
Run Code Online (Sandbox Code Playgroud)

c# reflection

8
推荐指数
2
解决办法
2807
查看次数

ASP.NET Web API内存中测试中的内部服务器错误

在内存测试中测试ASP.NET Web API控制器时,我收到"内部服务器错误"(状态码500).

[TestFixture]
public class ValuesControllerTest
{
    private HttpResponseMessage response;

    [TestFixtureSetUp]
    public void Given()
    {
        var config = new HttpConfiguration
        {
            IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always
        };

        config.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{id}",
            defaults: new { controller = typeof(ValuesController).Name.Replace("Controller", string.Empty), id = RouteParameter.Optional }
        );

        //This method will cause internal server error but NOT throw any exceptions
        //Remove this call and the test will be green
        ScanAssemblies();

        var server = new HttpServer(config);
        var client = new HttpClient(server);
        response = client.GetAsync("http://something/api/values/5").Result;
        //Here …
Run Code Online (Sandbox Code Playgroud)

asp.net asp.net-web-api

6
推荐指数
1
解决办法
5397
查看次数

EventStore NServiceBus设置

使用EventStore时如何与NServiceBus集成?

我是NSB和ES的新手,并试图在使用ES和CQRS时找出NSB的最佳设置.

我和示例中的DispatchCommit一样挂钩NSB, https://github.com/joliver/EventStore/blob/master/doc/EventStore.Example/MainProgram.cs

  1. 您是否发布了整个Commit或Commit.Events?
  2. 您是否为邮件创建了一个包装器,因为NSB需要对邮件进行IMessage?那你如何发布到正确的队列呢?因为例如,与OrderSubmittedEvent相比,包装器是通用的.如果可能的话,我不希望我的事件依赖于NSB,因为那时我在我的域中也有.

一些代码或指导非常感谢.

nservicebus cqrs

5
推荐指数
1
解决办法
1972
查看次数

标签 统计

asp.net ×1

asp.net-web-api ×1

c# ×1

cqrs ×1

nservicebus ×1

reflection ×1