Created
March 2, 2010 18:54
-
-
Save actaneon/319792 to your computer and use it in GitHub Desktop.
Revisions
-
actaneon created this gist
Mar 2, 2010 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ //Using Composition and IoC to add a logging to the IService implementation without violating OCP. //Instantiate with: For<IService>.Use<LoggingService>().Ctor<IService>().Is<SomeService>(); // //create a LoggingService : IService that takes the *real* IService in it's c'tor public class LoggingService : IService { private IService _realService; private ILogger _log; public LoggingService(IService realService, ILogger log) { _realService = realService; _log = log; } public void DoStuff() { _log.Log("Doing some stuff"); _realService.DoStuff(); } }