Refactoring Application Environment (Part 2)
Luca Milan notified me of a design issue. Until now the ApplicationEnvironment had an Instance property as following:
public static ApplicationEnvironment Instance { get { ... } }
A lot of flexibility can be added by extracting an interface IApplicationEnvironment and use that as return type for the property:
public static IApplicationEnvironment Instance { get { ... } }
Now that we have Common Service Locator i have decided to completely remove the Instance property. Code that requires an instance of the IApplicationEnvironment will have to resolve it via the ServiceLocator:
IApplicationEnvironment appEnv = ServiceLocator.Current.GetInstance<iapplicationEnvironment>();