Unity setting problem when defined in code
- by Xabatcha
I have problem when asking for default ILogger from Unity container. I have this setting defined in code (its VB.net)
Dim container As IUnityContainer
...
container.RegisterType(Of ILogger, NullLogger)()
container.RegisterType(Of ILogger, EntLibLogger)("EL")
When I am getting ILogger from container I may have different name, like:
Ioc.Resolve(Of ILogger)("MyLogger")
However this raises error as the mapping is not set for 'MyLogger'. Can I force container to return type which was registered without name? Actually when I used setting from web.config it worked.
Any tips most welcome. Thanks. Cheers, X.