Get registered nameless type

Apr 13, 2010 at 2:39 PM
Edited Apr 14, 2010 at 10:20 AM

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. Can I force container to return type which was registered without name?

 

I am using Unity1.2 in VB.Net project.

Any tip? Thanks for any help. Cheers X.