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.   Uri path = new Uri(Assembly.GetExecutingAssembly().CodeBase);
  8.   string combinedPath = Path.Combine(
  9.       Path.GetDirectoryName(path.LocalPath),
  10.       string.Format(
  11.        CultureInfo.InvariantCulture,
  12.        "dependencyresolver.{0}.cfg.xml",
  13.        MyApplication.Settings.Default.Mode));
  14.  
  15.   var fileMap = new ExeConfigurationFileMap { ExeConfigFilename = combinedPath };
  16.   var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
  17.  
  18.   //... Initialize the container using the configuration section retrieved
  19.  
  20.  }
  21.  public static T Resolve<T>()
  22.  {
  23.   return _container.Resolve<T>();
  24.  }
  25. }
');