In my legacy (well 'traditional') project I was addicted to NInject kernel and Log4Net and I used to do for the log something like this:
kernel.Bind<ILog>().ToMethod((ctx) =>
{
return LogManager.GetLogger(ctx.Request.Target.Member.DeclaringType);
});
that is, I bind the log factory to a function, and that function is able to auto wire the current type creating a Log for the current type. In the ASP.NET configuration I found a way to bind a service to a factory function, but that function will not receive any context information to understand the context the object is needed. Is it possible to emulate the same behavior I had with NInject in some way?