Hello and thank you for this tool. I have a problem with resolving ILogger with IServiceProvider. My implementation is pretty simple:
public class ServiceProvider : IServiceProvider
{
private readonly ILifetimeScope scope;
public ServiceProvider(ILifetimeScope scope)
{
this.scope = scope;
}
public object GetService(Type serviceType)
{
return scope.Resolve(serviceType);
}
}
and this is registration part:
var builder = new ContainerBuilder();
builder.RegisterModule<NLogModule>();
builder.RegisterType<ServiceProvider>().As<IServiceProvider>();
Types registered with RegisterType are resolved well, but when I try to resolve ILogger I got "The requested service 'NLog.ILogger' has not been registered" exception. If ILogger is injected as constructor parameter then is resolved well as part of ASP.NET DI. What am I doing wrong?
Your Readme says that there is SimpleNLogModule that "is useful when ILogger resolved from Service Locator". But it looks like it doesn't exist any more.
Hello and thank you for this tool. I have a problem with resolving ILogger with IServiceProvider. My implementation is pretty simple:
and this is registration part:
Types registered with
RegisterTypeare resolved well, but when I try to resolve ILogger I got "The requested service 'NLog.ILogger' has not been registered" exception. If ILogger is injected as constructor parameter then is resolved well as part of ASP.NET DI. What am I doing wrong?Your Readme says that there is
SimpleNLogModulethat "is useful when ILogger resolved from Service Locator". But it looks like it doesn't exist any more.