我正在尝试与Ninject一起使用bbv.common.EventBroker,并且遇到了一些问题,使事情正确连线。Ninject bbv EventBroker订阅错误
我目前正在使用Ninject工厂创建一个项目,然后,由于我订阅了事件,请使用事件经纪人进行订阅。但是,当调用注册方法时,我得到一个错误,我根本找不到任何信息。我甚至不知道错误的含义。
错误:
bbv.Common.EventBroker.Exceptions.RepeatedSubscriptionException发生 消息=无法添加同一用户一个话题不止一个订阅处理方法:“方法一”。 源= bbv.Common.EventBroker 堆栈跟踪: 在bbv.Common.EventBroker.Internals.EventTopic.ThrowIfRepeatedSubscription(对象订户,字符串handlerMethodName) 在bbv.Common.EventBroker.Internals.EventTopic.AddSubscription(对象订户,MethodInfo的handlerMethod ,IHandler handler,IList`1 subscriptionMatchers) at bbv.Common.EventBroker.Internals.EventInspector.HandleSubscriber(Object subscriber,Boolean register,MethodInfo methodInfo,EventSubscriptionAttribute attr,IEventTopicHost eventTopicHost) at bbv.Common.EventBroker.Internals.EventInspector。 ProcessSubscriber(对象订阅者,布尔寄存器,IEventTopicHost eventTopicHost) at bbv.Common.EventBroker.EventBroker.Register(Object item)
I nnerException:
代码:
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)
{
...
}