Events Ninject bbv EventBroker订阅错误

Events Ninject bbv EventBroker订阅错误,events,ninject,publish-subscribe,Events,Ninject,Publish Subscribe,我试图将bbv.common.EventBroker与Ninject一起使用,但在正确连接时遇到了一些问题 我目前正在使用Ninject工厂创建一个项目,然后,因为我订阅了事件,所以使用eventbroker进行订阅。然而,当调用register方法时,我得到一个错误,我根本找不到任何信息。我甚至不知道这个错误是什么意思 错误: public const string Topic1 = "Topic1"; public const string Topic2 = "Topic2"; public

我试图将bbv.common.EventBroker与Ninject一起使用,但在正确连接时遇到了一些问题

我目前正在使用Ninject工厂创建一个项目,然后,因为我订阅了事件,所以使用eventbroker进行订阅。然而,当调用register方法时,我得到一个错误,我根本找不到任何信息。我甚至不知道这个错误是什么意思

错误:

public const string Topic1 = "Topic1";
public const string Topic2 = "Topic2";
public const string Topic3 = "Topic3";
public const string Topic4 = "Topic4";

public ItemHelper(IItem item, IEventBroker eventBroker)
{
  _item = item;
  eventBroker.Register(this);
}

[EventSubscription(Topic1, typeof(bbv.Common.EventBroker.Handlers.Publisher))]
public void Method1(object sender, SomeArgs1 args)
{
  ...
}

[EventSubscription(Topic2, typeof(bbv.Common.EventBroker.Handlers.Publisher))]
public void Method2(object sender, SomeArgs2 args)
{
  ...
}

[EventSubscription(Topic3, typeof(bbv.Common.EventBroker.Handlers.Publisher))]
public void Method3(object sender, SomeArgs3 args)
{
  ...
}

[EventSubscription(Topic4, typeof(bbv.Common.EventBroker.Handlers.Publisher))]
public void Method4(object sender, SomeArgs4 args)
{
  ...
}
发生bbv.Common.EventBroker.Exceptions.RepeatedSubscriptionException Message=不能将同一订阅服务器的多个订阅处理程序方法添加到一个主题:“Method1”。 Source=bbv.Common.EventBroker 堆栈跟踪: 位于bbv.Common.EventBroker.Internals.EventTopic.ThrowIfRepeatedSubscription(对象订阅者,字符串handlerMethodName) 在bbv.Common.EventBroker.Internals.EventTopic.AddSubscription(对象订阅者、MethodInfo handlerMethod、IHandler处理程序、IList`1 subscriptionMatchers) 位于bbv.Common.EventBroker.Internals.EventInspector.HandleSubscriber(对象订阅服务器、布尔寄存器、MethodInfo MethodInfo、EventSubscriptionAttribute attr、IEventTopicHost eventTopicHost) 位于bbv.Common.EventBroker.Internals.EventInspector.ProcessSubscriber(对象订阅服务器、布尔寄存器、IEventTopicHost eventTopicHost eventTopicHost) 在bbv.Common.EventBroker.EventBroker.Register(对象项)
内部异常:

代码:

public const string Topic1 = "Topic1";
public const string Topic2 = "Topic2";
public const string Topic3 = "Topic3";
public const string Topic4 = "Topic4";

public ItemHelper(IItem item, IEventBroker eventBroker)
{
  _item = item;
  eventBroker.Register(this);
}

[EventSubscription(Topic1, typeof(bbv.Common.EventBroker.Handlers.Publisher))]
public void Method1(object sender, SomeArgs1 args)
{
  ...
}

[EventSubscription(Topic2, typeof(bbv.Common.EventBroker.Handlers.Publisher))]
public void Method2(object sender, SomeArgs2 args)
{
  ...
}

[EventSubscription(Topic3, typeof(bbv.Common.EventBroker.Handlers.Publisher))]
public void Method3(object sender, SomeArgs3 args)
{
  ...
}

[EventSubscription(Topic4, typeof(bbv.Common.EventBroker.Handlers.Publisher))]
public void Method4(object sender, SomeArgs4 args)
{
  ...
}

事实证明,该类有一个接口,其方法上具有[EventSubscription]属性。既然我知道了这一点,那么错误消息确实更有意义