private static void InitConfiguration() { var section = System.Configuration.ConfigurationManager.GetSection("AnitoProviderConfiguration"); if (section == null) throw new Exception("Default Anito Provider Configuration Section doesn't exist (AnitoProviderConfiguration)"); s_configuration = section as ProviderConfiguration; if(Equals(s_configuration, null)) throw new NullReferenceException("s_configuration"); foreach (ProviderConfigurationElement element in s_configuration.Providers) { var setting = new ProviderSetting{ Name = element.Name , ConnectionString = element.ConnectionString , ProviderTypeName = element.Type}; ProviderCache.Add(element.Name, setting); var source = new TypeSchemaSource(); foreach (SchemaSourceElement schemaElement in element.SchemaSourceCollection) { if(!File.Exists(schemaElement.SourceFile)) throw new FileNotFoundException(schemaElement.SourceFile); XmlReader reader = new XmlTextReader(schemaElement.SourceFile); (source as IXmlSerializable).ReadXml(reader); reader.Close(); } CacheManager.SchemaCache.Add(element.Name, source); } }
private static void InitConfiguration() { var section = System.Configuration.ConfigurationManager.GetSection("AnitoProviderConfiguration"); if (section == null) throw new Exception("Default Anito Provider Configuration Section doesn't exist (AnitoProviderConfiguration)"); m_configuration = section as ProviderConfiguration; foreach (ProviderConfigurationElement element in m_configuration.Providers) { ProviderSetting setting = new ProviderSetting(); setting.Name = element.Name; setting.ConnectionString = element.ConnectionString; setting.ProviderTypeName = element.Type; ProviderCache.Add(element.Name, setting); TypeSchemaSource source = new TypeSchemaSource(); foreach (SchemaSourceElement schemaElement in element.SchemaSourceCollection) { XmlReader reader = new XmlTextReader(schemaElement.SourceFile); (source as IXmlSerializable).ReadXml(reader); reader.Close(); } CacheManager.SchemaCache.Add(element.Name, source); } }
public static void SetProviderConfiguration(ProviderConfiguration configuration) { m_configuration = configuration; }