You need to register a type mapping for your interface ILogger
. Otherwise does Unity not now which implementation of ILogger
it should use (see your exception).
Here´s an example registering the interface ILogger
with a mapping to FileLogger
:
_container.RegisterType<ILogger, FileLogger>();
IProduct product = _container.Resolve<ProductA>(); //ILogger is injected to Product