Dependency Injection

Injected log4net Logger

Blog post is for personal reference for the cases when you need to get instance of some sort of logger from the Logging library you are using. It depends on logging library that you use but usually you may get instance of logger itself by providing some metadata about calling site or producer of the log entries. Code usually looks somewhat similar: private readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); As you can see it’s not really ready for injection as it requires concrete type in order to…

Keep reading

FeatureSwitch library 1.0 – Released!

Have you ever wrote the code like following to verify that either you have to disable or enable some functionality base on set of conditions (usually different sources): if(ConfigurationManager.AppSettings["MyKey"] == "true") { // feature is enabled - do something ...; } else { // feature is disabled - do something ...; } or something like this: if(HttpContext.Current != null && HttpContext.Current.Session != null && HttpContext.Current.Session["MyKey"] == "true") { return ...; } FeatureSwitch library should reduce amount of time and code needed to implement feature toggle…

Keep reading