Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ILog logger_a = LogManager.GetLogger("A");
- ILog logger_b = LogManager.GetLogger("B");
- ILog logger_c = LogManager.GetLogger("C");
- // During application initialization
- IUnityContainer myContainer = new UnityContainer();
- LoggingService concreteLoggingService = new LoggingService( "logID" );
- myContainer.RegisterInstance<ILoggingService>( concreteLoggingService );
- // This would be injected, so you wouldn't see this, but it's here for consistency
- ILoggingService loggingService = myContainer.Resolve<ILoggingService>();
- loggingService.LogMessage( "message" );
- // During application initialization
- ServiceLocator.Register<ILoggingService>( new LoggingService( "logID" ) );
- // Retrieved as needed
- ILoggingService loggingServce = LoggingServiceLocator.Locate<ILoggingService>();
- loggingService.LogMessage( "message" );
Add Comment
Please, Sign In to add comment