public ConnectionStringsSectionNodeBuilder(IServiceProvider serviceProvider, ConnectionStringsSection conectionStringsSection, string defaultDatabaseName, DatabaseSectionNode databaseSectionNode) : base(serviceProvider) { this.connectionStringSections = conectionStringsSection; this.databaseSectionNode = databaseSectionNode; this.defaultDatabaseName = defaultDatabaseName; }
/// <summary> /// Gets the a <see cref="ConfigurationSectionInfo"/> for the oracle connection configuration section. /// </summary> /// <param name="serviceProvider">The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param> /// <returns>A <see cref="ConfigurationSectionInfo"/> for the oracle connection configuration section.</returns> protected override ConfigurationSectionInfo GetConfigurationSectionInfo(IServiceProvider serviceProvider) { ConfigurationNode rootNode = ServiceHelper.GetCurrentRootNode(serviceProvider); DatabaseSectionNode databaseSectionNode = null; if (rootNode != null) { databaseSectionNode = rootNode.Hierarchy.FindNodeByType(rootNode, typeof(DatabaseSectionNode)) as DatabaseSectionNode; } OracleConnectionSettings oracleConnectionSection = null; IList <ConfigurationNode> connections = rootNode.Hierarchy.FindNodesByType(typeof(OracleConnectionElementNode)); if (connections.Count == 0) { oracleConnectionSection = null; } else { OracleConnectionSettingsBuilder builder = new OracleConnectionSettingsBuilder(serviceProvider); oracleConnectionSection = builder.Build(); } string protectionProviderName = GetProtectionProviderName(databaseSectionNode); return(new ConfigurationSectionInfo(rootNode, oracleConnectionSection, OracleConnectionSettings.SectionName, protectionProviderName)); }
protected override ConfigurationSectionInfo GetConfigurationSectionInfo(IServiceProvider serviceProvider) { ConfigurationNode rootNode = ServiceHelper.GetCurrentRootNode(serviceProvider); ConnectionStringsSectionNode node = null; DatabaseSectionNode databaseSectionNode = null; if (null != rootNode) { node = rootNode.Hierarchy.FindNodeByType(rootNode, typeof(ConnectionStringsSectionNode)) as ConnectionStringsSectionNode; databaseSectionNode = rootNode.Hierarchy.FindNodeByType(rootNode, typeof(DatabaseSectionNode)) as DatabaseSectionNode; } ConnectionStringsSection connectionStrings = null; if (node == null) { connectionStrings = null; } else { ConnectionStringsSectionBuilder builder = new ConnectionStringsSectionBuilder(serviceProvider, node); connectionStrings = builder.Build(); } string protectionProviderName = GetProtectionProviderName(databaseSectionNode); return(new ConfigurationSectionInfo(node, connectionStrings, "connectionStrings", protectionProviderName)); }
public ConnectionStringsSectionNodeBuilder(IServiceProvider serviceProvider, ConnectionStringsSection conectionStringsSection, string defaultDatabaseName, DatabaseSectionNode databaseSectionNode) : base(serviceProvider) { this.connectionStringSections = conectionStringsSection; this.databaseSectionNode = databaseSectionNode; this.defaultDatabaseName = defaultDatabaseName; }
/// <summary> /// Opens the database settings configuration section, builds the design time nodes and adds them to the application node. /// </summary> /// <param name="serviceProvider">The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param> /// <param name="rootNode">The root node of the application.</param> /// <param name="section">The <see cref="ConfigurationSection"/> that was opened from the <see cref="IConfigurationSource"/>.</param> protected override void OpenCore(IServiceProvider serviceProvider, ConfigurationApplicationNode rootNode, ConfigurationSection section) { if (null != section) { DatabaseSectionNodeBuilder builder = new DatabaseSectionNodeBuilder(serviceProvider, (DatabaseSettings)section); DatabaseSectionNode node = builder.Build(); SetProtectionProvider(section, node); rootNode.AddNode(node); } }
public DatabaseSectionNode Build() { DatabaseSectionNode node = new DatabaseSectionNode(); ProviderMappingsNode mappingsNode = new ProviderMappingsNode(); foreach (DbProviderMapping mapping in databaseSettings.ProviderMappings) { mappingsNode.AddNode(new ProviderMappingNode(mapping)); } node.AddNode(mappingsNode); return node; }
public DatabaseSectionNode Build() { DatabaseSectionNode node = new DatabaseSectionNode(); ProviderMappingsNode mappingsNode = new ProviderMappingsNode(); foreach (DbProviderMapping mapping in databaseSettings.ProviderMappings) { mappingsNode.AddNode(new ProviderMappingNode(mapping)); } node.AddNode(mappingsNode); return(node); }
public DatabaseSectionNode Build() { DatabaseSectionNode node = new DatabaseSectionNode(); ProviderMappingsNode mappingsNode = new ProviderMappingsNode(); foreach (DbProviderMapping mapping in databaseSettings.ProviderMappings) { mappingsNode.AddNode(new ProviderMappingNode(mapping)); } node.AddNode(mappingsNode); node.RequirePermission = databaseSettings.SectionInformation.RequirePermission; return(node); }
protected override void OnExecuted(EventArgs e) { DatabaseSectionNode node = ChildNode as DatabaseSectionNode; Debug.Assert(null != node, "Expected DatabaseSectionNode"); if (addDefaultConnectionString) { new AddConnectionStringsSectionNodeCommand(ServiceProvider).Execute(node); ConnectionStringSettingsNode defaultDatabaseNode = (ConnectionStringSettingsNode)CurrentHierarchy.FindNodeByType(node, typeof(ConnectionStringSettingsNode)); node.DefaultDatabase = defaultDatabaseNode; } node.AddNode(new ProviderMappingsNode()); }
/// <summary> /// Opens the connection strings section, builds the design time nodes and adds them to the application node. /// </summary> /// <param name="serviceProvider">The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param> /// <param name="rootNode">The root node of the application.</param> /// <param name="section">The <see cref="ConfigurationSection"/> that was opened from the <see cref="IConfigurationSource"/>.</param> protected override void OpenCore(IServiceProvider serviceProvider, ConfigurationApplicationNode rootNode, ConfigurationSection section) { if (null != section) { string defaultDatabase = string.Empty; DatabaseSettings databaseSection = DatabaseSettings.GetDatabaseSettings(GetConfigurationSource(serviceProvider)); if (null != databaseSection) { defaultDatabase = databaseSection.DefaultDatabase; } DatabaseSectionNode node = rootNode.Hierarchy.FindNodeByType(typeof(DatabaseSectionNode)) as DatabaseSectionNode; if (null == node) { AddDatabaseSectionNodeCommand dbCmd = new AddDatabaseSectionNodeCommand(serviceProvider, false); dbCmd.Execute(rootNode); node = dbCmd.ChildNode as DatabaseSectionNode; Debug.Assert(node != null); } ConnectionStringsSectionNodeBuilder builder = new ConnectionStringsSectionNodeBuilder(serviceProvider, (ConnectionStringsSection)section, defaultDatabase, node); node.AddNode(builder.Build()); } }
/// <summary> /// Gets the a <see cref="ConfigurationSectionInfo"/> for the database settings configuration section. /// </summary> /// <param name="serviceProvider">The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param> /// <returns>A <see cref="ConfigurationSectionInfo"/> for the database settings configuration section.</returns> protected override ConfigurationSectionInfo GetConfigurationSectionInfo(IServiceProvider serviceProvider) { ConfigurationNode rootNode = ServiceHelper.GetCurrentRootNode(serviceProvider); DatabaseSectionNode node = null; if (null != rootNode) { node = rootNode.Hierarchy.FindNodeByType(rootNode, typeof(DatabaseSectionNode)) as DatabaseSectionNode; } DatabaseSettings databaseSection = null; if (node == null) { databaseSection = null; } else { DatabaseSectionBuilder builder = new DatabaseSectionBuilder(serviceProvider, node); databaseSection = builder.Build(); } return(new ConfigurationSectionInfo(node, databaseSection, DatabaseSettings.SectionName)); }
public DatabaseSectionBuilder(IServiceProvider serviceProvider, DatabaseSectionNode databaseSectionNode) { this.databaseSectionNode = databaseSectionNode; this.hierarchy = ServiceHelper.GetCurrentHierarchy(serviceProvider); }
public DatabaseSectionBuilder(IServiceProvider serviceProvider, DatabaseSectionNode databaseSectionNode) { this.databaseSectionNode = databaseSectionNode; this.hierarchy = ServiceHelper.GetCurrentHierarchy(serviceProvider); }