I have the following interface:
public interface ILogger
{
void Debug(string message, params object[] values);
void Info(string message, params objec
I really need to get out of the habit of answering my own question, but for those who run across it, here's the answer.
return ObjectFactory.With(type).GetInstance();
I actually have a wrapper to structuremap (to avoid exposing the structuremap dependency to my app) that looks like the following:
public static class ServiceManager
{
public static T Get()
{
return ObjectFactory.GetInstance();
}
public static T Get(Type type)
{
return ObjectFactory.With(type).GetInstance();
}
}
Any time in the code I need a logger, I call the following:
ServiceManager.Get(GetType()).Info("Logging page view...");