{"action":"opened","issue":{"url":"https://api.github.com/repos/AtmosphereMessaging/Cumulus/issues/9","labels_url":"https://api.github.com/repos/AtmosphereMessaging/Cumulus/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/AtmosphereMessaging/Cumulus/issues/9/comments","events_url":"https://api.github.com/repos/AtmosphereMessaging/Cumulus/issues/9/events","html_url":"https://github.com/AtmosphereMessaging/Cumulus/issues/9","id":111254278,"number":9,"title":"Explicitly register all types in DI-container when creating bus","user":{"login":"allansson","id":2014167,"avatar_url":"https://avatars.githubusercontent.com/u/2014167?v=3","gravatar_id":"","url":"https://api.github.com/users/allansson","html_url":"https://github.com/allansson","followers_url":"https://api.github.com/users/allansson/followers","following_url":"https://api.github.com/users/allansson/following{/other_user}","gists_url":"https://api.github.com/users/allansson/gists{/gist_id}","starred_url":"https://api.github.com/users/allansson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allansson/subscriptions","organizations_url":"https://api.github.com/users/allansson/orgs","repos_url":"https://api.github.com/users/allansson/repos","events_url":"https://api.github.com/users/allansson/events{/privacy}","received_events_url":"https://api.github.com/users/allansson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/AtmosphereMessaging/Cumulus/labels/refactor","name":"refactor","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-13T19:39:59Z","updated_at":"2015-10-13T19:39:59Z","closed_at":null,"body":"Currently when building a `Bus`-object with the `BusBuilder`-class, much of the wireup is done implicitly by the DI-container (see [PoorMansIoC.cs, line 80](https://github.com/AtmosphereMessaging/Cumulus/blob/dev/src/Cumulus/Configuration/PoorMansIoC.cs#L80-89)). While it can be convenient, it makes it that much harder to understand which concrete type is actually being used when the bus is created. I'd really like to be able to do a \"Find All References\" to find out how a type is being created, which is not possible when types are instantiated implicitly.\r\n\r\nEven worse is that it is harder to know when a type can be resolved. For instance, I was trying to modify the constructor of the Heartbeat-class to accept a new type `IHeartbeatListener` which required an `BusEventSender`-instance. The `BusEventSender` in turn required an instance of a `IBrokeredMessageFactory`. Depending on where I placed the registration in the Build-method of `BusBuilder` the DI-container failed to resolve my `IHeartbeatListener`. The norm should be to do all registrations before resolving any instances. Many DI-frameworks actually disallow further registrations after the first instance has been resolved.\r\n\r\nSo, we should refactor the `PoorMansIoC`-code to not allow implicit registrations and register all instances in `BusBuilder`. We should also defer any resolving of instances until we have completed all registrations."}}