document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. public class DependencyResolver
  2. {
  3.  static readonly IDependencyResolverContainer _container;
  4.  
  5.  static DependencyResolver()
  6.  {
  7.   string path = Path.Combine(
  8.       Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase),
  9.       string.Format(
  10.        CultureInfo.InvariantCulture,
  11.        "dependencyresolver.{0}.cfg.xml",
  12.        MyApplication.Settings.Default.Mode));
  13.    
  14.   var fileMap = new ExeConfigurationFileMap { ExeConfigFilename = path };
  15.   var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
  16.  
  17.   //... Initialize the container using the configuration section retrieved
  18.  
  19.   return _container.Resolve<T>();
  20.  }
  21.  public static T Resolve<T>()
  22.  {
  23.   return _container.Resolve<T>();
  24.  }
  25. }
');