コード例 #1
0
        /// <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));
        }
コード例 #2
0
        protected override void OnExecuted(EventArgs e)
        {
            ConnectionStringsSectionNode node = ChildNode as ConnectionStringsSectionNode;

            Debug.Assert(null != node, "Expected ConnectionStringsSectionNode");

            new AddConnectionStringSettingsNodeCommand(ServiceProvider).Execute(node);
        }
コード例 #3
0
 public ConnectionStringsSectionNode Build()
 {
     node = new ConnectionStringsSectionNode();
     foreach (ConnectionStringSettings connectionString in connectionStringSections.ConnectionStrings)
     {
         BuildConnectionStringNode(connectionString);
     }
     return(node);
 }
コード例 #4
0
		public ConnectionStringsSectionNode Build()
		{
			node = new ConnectionStringsSectionNode();			
			foreach (ConnectionStringSettings connectionString in connectionStringSections.ConnectionStrings)
			{
				BuildConnectionStringNode(connectionString);
			}						
			return node;
		}		
コード例 #5
0
		public ConnectionStringsSectionBuilder(IServiceProvider serviceProvider, ConnectionStringsSectionNode connectionStringsSectionNode) 
		{
			this.connectionStringsSectionNode = connectionStringsSectionNode;
			hierarchy = ServiceHelper.GetCurrentHierarchy(serviceProvider);
		}
コード例 #6
0
 public ConnectionStringsSectionBuilder(IServiceProvider serviceProvider, ConnectionStringsSectionNode connectionStringsSectionNode)
 {
     this.connectionStringsSectionNode = connectionStringsSectionNode;
     hierarchy = ServiceHelper.GetCurrentHierarchy(serviceProvider);
 }