CodeRun : programmare online

http://www.coderun.com

incredibile......

Unity leggere la configurazione da uno specifico file

   1:  public static IUnityContainer GetContainerFromAnotherFile(string unityConfigName,string containerName)
   2:          {
   3:              UnityConfigurationSection section = GetUnityConfigSection();
   4:              UnityContainerElement configElement = new UnityContainerElement();
   5:              IUnityContainer container = new UnityContainer();
   6:              
   7:              var map = new ExeConfigurationFileMap();
   8:              map.ExeConfigFilename = unityConfigName;
   9:   
  10:              var config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);
  11:              section = (UnityConfigurationSection)config.GetSection("unity");
  12:              container = new UnityContainer();
  13:              section.Containers[containerName].Configure(container);
  14:              configElement.Configure(container);
  15:   
  16:              return container;
  17:   
  18:          }
«October»
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567