大众运输分析仪

问题描述

在全新的C#项目中 使用Masstransit.Analyzers nuget软件包(https://masstransit-project.com/learn/analyzers.html#message-initializers

如果我致电IPublishEndpoint.Publish<ISomeInterface>(new { random="fields"}) 按预期生成消息

匿名类型缺少消息协定“ ISomeInterface”中的属性。缺少以下属性名称,姓氏等

如果我使用装饰器模式创建自己的发布商

public interface IMyOwnPublishEndpoint{

  Task Publish<T>(object values,CancellationToken cancellationToken = default)
            where T : class;
}

public class MyOwnPublishEndpoint : IMyOwnPublishEndpoint
{
    private readonly IPublishEndpoint endpoint;
    MyOwnPublishEndpoint (IPublishEndpoint endpoint)
    {
        this.endpoint = endpoint;
    }

 public async Task Publish<T>(object values,CancellationToken cancellationToken = default)
            where T : class
    {
        await endpoint.Publish<T>(values,cancellationToken )
    }

}

当我致电IMyOwnPublishEndpoint.Publish<ISomeInterface>(new { random="fields"})

不会生成相同的消息

为什么会这样? Masstransit Analyzer可能仅限于一组特定的接口吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)