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:
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 that, or other types of ‘tricks’, you will be told that it is bad design and you are a bad developer and you should give up and go into sales….or something like that).
You can instead register like this:
container.Register<IQueryBus>(() => new QueryBus("MyQueryBus"));
That will work.