Posts
1147
Comments
890
Trackbacks
1
SimpleInjector
SimpleInjector
SimpleInjector – Registering when you have a primitive in the constructor

Suppose you have a class that has something like a string parameter in its constructor, like: public class QueryBus(string busName) : IQueryBus If you try to register this using SimpleInjector the normal way, like this: container.Register<IQueryBus, QueryBus>(); you will get an exception when you call container.Verify(), like this: The constructor of type QueryBus contains parameter 'name' of type String which can not be used for constructor injection. You can also get other errors, depending on what you are trying to do, and obviously, you can’t register a string (and if you try to do...

posted @ Sunday, January 11, 2015 1:47 PM | Feedback (0)