/// <summary> /// Gets the a <see cref="ConfigurationSectionInfo"/> for the connection strings 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 connection strings section.</returns> 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)); }
protected override void OnExecuted(EventArgs e) { ConnectionStringsSectionNode node = ChildNode as ConnectionStringsSectionNode; Debug.Assert(null != node, "Expected ConnectionStringsSectionNode"); new AddConnectionStringSettingsNodeCommand(ServiceProvider).Execute(node); }
public ConnectionStringsSectionNode Build() { node = new ConnectionStringsSectionNode(); foreach (ConnectionStringSettings connectionString in connectionStringSections.ConnectionStrings) { BuildConnectionStringNode(connectionString); } return(node); }
public ConnectionStringsSectionNode Build() { node = new ConnectionStringsSectionNode(); foreach (ConnectionStringSettings connectionString in connectionStringSections.ConnectionStrings) { BuildConnectionStringNode(connectionString); } return node; }
public ConnectionStringsSectionBuilder(IServiceProvider serviceProvider, ConnectionStringsSectionNode connectionStringsSectionNode) { this.connectionStringsSectionNode = connectionStringsSectionNode; hierarchy = ServiceHelper.GetCurrentHierarchy(serviceProvider); }