0

Ninject で bbv.common.EventBroker を使用しようとしていますが、正しく接続するのにいくつかの問題が発生しています。

現在、Ninject ファクトリを使用してアイテムを作成し、イベントをサブスクライブしているため、イベント ブローカを使用してサブスクリプションを実行しています。ただし、登録メソッドが呼び出されると、情報がまったく見つからないというエラーが発生します。エラーが何を意味するのかさえわかりません。

エラー:

bbv.Common.EventBroker.Exceptions.RepeatedSubscriptionException が発生しました。メッセージ = 同じサブスクライバー 1 つのトピックの複数のサブスクリプション ハンドラー メソッドを追加することはできません: 'Method1'。ソース = bbv.Common.EventBroker StackTrace: 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(オブジェクト サブスクライバー、ブール値)登録、
内部例外:

コード:

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)
{
  ...
}
4

1 に答える 1