public Configuration Build() { Guard.ArgumentNotNull(ConfigurationCreator, "Configuration Creator"); Configuration configuration = null; //1. Create the Configuration configuration = ConfigurationCreator.Create(); //2. Configure Custom Extensions if (CustomExtensionsConfigurator != null) { configuration = CustomExtensionsConfigurator.Configure(configuration); } //3. Add the mapping information if (MappingInfoLoader != null) { configuration = MappingInfoLoader.Load(configuration); } //4. Add Custom Mapping file string mappingFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "CustomMapping.hbm.xml"); if (File.Exists(mappingFile)) { configuration.AddXmlFile(mappingFile); } return(configuration); }
public void SetUp() { if (!AppConfig.Loaded) { AppConfig.Load(ConfigFactory.CreateXmlConfig()); } _cache = new ObjectMapInfoCache(); MappingInfoLoader.Load(_cache); }
public Dictionary <int, Configuration> BuildAll(NHibernateConfig config) { Guard.ArgumentNotNull(ConfigurationCreator, "Configuration Creator"); Dictionary <int, Configuration> configurations = null; Dictionary <int, Configuration> result = null; //1. Create the Configurations configurations = ConfigurationCreator.CreateAll(config); if (configurations != null) { result = new Dictionary <int, Configuration>(); IEnumerator enumerator = configurations.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair <int, Configuration> valuePair = (KeyValuePair <int, Configuration>)enumerator.Current; Configuration configuration = valuePair.Value; //2. Configure Custom Extensions if (CustomExtensionsConfigurator != null) { configuration = CustomExtensionsConfigurator.Configure(configuration); } //3. Add the mapping information if (MappingInfoLoader != null) { configuration = MappingInfoLoader.Load(configuration); } //4. Add Custom Mapping file string mappingFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "CustomMapping.hbm.xml"); if (File.Exists(mappingFile)) { configuration.AddXmlFile(mappingFile); } result.Add(valuePair.Key, configuration); } } return(result); }
//public Dictionary<int, Configuration> BuildAll(List<DataBaseTenant> dataBaseTenants) //{ // Guard.ArgumentNotNull(ConfigurationCreator, "Configuration Creator"); // Dictionary<int, Configuration> configurations = null; // Dictionary<int, Configuration> result = null; // //1. Create the Configurations // configurations = ConfigurationCreator.CreateAll(dataBaseTenants); // if (configurations != null) // { // result = new Dictionary<int, Configuration>(); // IEnumerator enumerator = configurations.GetEnumerator(); // while (enumerator.MoveNext()) // { // KeyValuePair<int, Configuration> valuePair = (KeyValuePair<int, Configuration>)enumerator.Current; // Configuration configuration = valuePair.Value; // //2. Configure Custom Extensions // if (CustomExtensionsConfigurator != null) // configuration = CustomExtensionsConfigurator.Configure(configuration); // //3. Add the mapping information // if (MappingInfoLoader != null) // configuration = MappingInfoLoader.Load(configuration); // result.Add(valuePair.Key, configuration); // } // } // return result; //} public Dictionary <int, Configuration> BuildAll(ICollection <DataBase> dataBases) { Guard.ArgumentNotNull(ConfigurationCreator, "Configuration Creator"); Dictionary <int, Configuration> configurations = null; Dictionary <int, Configuration> result = null; //1. Create the Configurations configurations = ConfigurationCreator.CreateAll(dataBases); if (configurations != null) { result = new Dictionary <int, Configuration>(); IEnumerator enumerator = configurations.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair <int, Configuration> valuePair = (KeyValuePair <int, Configuration>)enumerator.Current; Configuration configuration = valuePair.Value; //2. Configure Custom Extensions if (CustomExtensionsConfigurator != null) { configuration = CustomExtensionsConfigurator.Configure(configuration); } //3. Add the mapping information if (MappingInfoLoader != null) { configuration = MappingInfoLoader.Load(configuration); } result.Add(valuePair.Key, configuration); } } return(result); }