Created
December 8, 2011 06:40
-
-
Save anaisbetts/1446299 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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