Skip to content

Instantly share code, notes, and snippets.

@anaisbetts
Created December 8, 2011 06:40
Show Gist options
  • Select an option

  • Save anaisbetts/1446299 to your computer and use it in GitHub Desktop.

Select an option

Save anaisbetts/1446299 to your computer and use it in GitHub Desktop.
public static class GlobalStuff {
public ILogger TheLog { get; set; }
public IDatabaseProvider TheDatabase { get; set; }
}
public void AppStart()
{
// This is the same as initializing DI container
TheLog = new StdErrLogger();
TheDatabase = new NHibernate();
}
public class MyCoolClass
{
public MyCoolClass()
{
// What's the difference between this and injection?
ILogger injectedLogger = GlobalStuff.TheLog;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment