Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9222011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:42:49+00:00 2026-06-18T03:42:49+00:00

I am using Ninject’s bbEventBroker extension to wire up some pub/sub in my application.

  • 0

I am using Ninject’s bbEventBroker extension to wire up some pub/sub in my application. I have business services which publish events, and then I have other classes which subscribe to events. The wiring with Ninject is working, with one problem. I don’t see an obvious place where I should instantiate the event subscribers. Right now I am hacking it is, and just making sure all of the subscribers are requested into the kernel as singletons before anyone else uses it. But this doesn’t seem right. If I do nothing, then there are no instances of the subscribers, and the events end up getting ignored.

How should I instantiate the subscribers to bbEventBroker events so that they end up wired into the kernel?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:42:51+00:00Added an answer on June 18, 2026 at 3:42 am

    I ended up creating some pretty hacky code to solve this, but it does work. In my Ninject module which wires up the event subscribers, I also add an OnActivation handler for IEventBroker. When that activation handler is called, I do a Get on the Kernel for each subscriber (by using reflection to find the right types). This ensures that an instance of each subscriber is wired into the broker.

    This leads to an issue where, for some reason, IEventBrokers can be activated while Ninject is trying to dispose. So, I had to override OnDispose on my module and set a flag to stop doing the above once dispose has started. Hacks upon hacks! 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Ninject for DI. I have Ninject Modules that bind some services
I am currently creating an MVC3 application using Ninject. I have two controllers which
I'm using Ninject to do dependency injection. I have a userService in which I
I'm currently using Ninject to create instances of interfaces in a WCF Services application.
I have a system which was using Ninject and loading assemblies using the file
I have started using Ninject 2 (downloaded from Github yesterday including the MVC extension
I am using Ninject with Windows Phone application. My logic includes IBarViewModel interface which
I'm working on a framework extension which handles dynamic injection using Ninject as the
I'm using Ninject 2.2 with the WCF extension. On most of my services the
I have an MVC application using Ninject to connect to a single database. Now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.