Exemplo n.º 1
0
        /// <summary>
        /// <para>
        /// Add the default child nodes for the current node.
        /// </para>
        /// </summary>
        /// <remarks>
        /// <para>
        /// This will add the default instance nodes for an application.
        /// </para>
        /// </remarks>
        protected override void AddDefaultChildNodes()
        {
            base.AddDefaultChildNodes();
            InstanceNode sqlServer = new InstanceNode();

            Nodes.Add(sqlServer);
            ConnectionStringCollectionNode connectionStringCollectionNode = Hierarchy.FindNodeByType(Parent, typeof(ConnectionStringCollectionNode)) as ConnectionStringCollectionNode;

            sqlServer.ConnectionStringNode = Hierarchy.FindNodeByName(connectionStringCollectionNode, SR.DefaultNewConnectionStringName) as ConnectionStringNode;
            DatabaseTypeCollectionNode databaseTypeCollectionNode = Hierarchy.FindNodeByType(Parent, typeof(DatabaseTypeCollectionNode)) as DatabaseTypeCollectionNode;

            sqlServer.DatabaseTypeNode = Hierarchy.FindNodeByName(databaseTypeCollectionNode, SR.DefaultDatabaseTypeName) as DatabaseTypeNode;
        }
Exemplo n.º 2
0
        /// <summary>
        /// <para>After the node is loaded, allows child nodes to resolve references to sibling nodes in configuration.</para>
        /// </summary>
        public override void ResolveNodeReferences()
        {
            base.ResolveNodeReferences();
            ConnectionStringCollectionNode connectionStringCollectionNode = Hierarchy.FindNodeByType(Parent.Parent, typeof(ConnectionStringCollectionNode)) as ConnectionStringCollectionNode;

            ConnectionStringNode = Hierarchy.FindNodeByName(connectionStringCollectionNode, instanceData.ConnectionString) as ConnectionStringNode;
            if (connectionStringNode == null)
            {
                throw new InvalidOperationException(SR.ExceptionConnectionStringNodeNotFound(this.instanceData.ConnectionString, this.instanceData.Name));
            }
            DatabaseTypeCollectionNode databaseTypeCollectionNode = Hierarchy.FindNodeByType(Parent.Parent, typeof(DatabaseTypeCollectionNode)) as DatabaseTypeCollectionNode;

            DatabaseTypeNode = Hierarchy.FindNodeByName(databaseTypeCollectionNode, instanceData.DatabaseTypeName) as DatabaseTypeNode;
            if (databaseTypeNode == null)
            {
                throw new InvalidOperationException(SR.ExceptionDatabaseTypeNodeNotFound(this.instanceData.DatabaseTypeName, this.instanceData.Name));
            }
        }
Exemplo n.º 3
0
        private void GetConnectionStringCollectionData()
        {
            ConnectionStringCollectionNode node = Hierarchy.FindNodeByType(typeof(ConnectionStringCollectionNode)) as ConnectionStringCollectionNode;

            if (node == null)
            {
                return;
            }

            ConnectionStringDataCollection data = node.ConnectionStringDataCollection;

            if (Object.ReferenceEquals(databaseSettings.ConnectionStrings, data))
            {
                return;
            }

            databaseSettings.ConnectionStrings.Clear();
            foreach (ConnectionStringData connectionStringData in data)
            {
                databaseSettings.ConnectionStrings[connectionStringData.Name] = connectionStringData;
            }
        }
Exemplo n.º 4
0
        private void AddDefaultConnectionStringCollectionNode()
        {
            ConnectionStringCollectionNode node = new ConnectionStringCollectionNode(databaseSettings.ConnectionStrings);

            Nodes.AddWithDefaultChildren(node);
        }
Exemplo n.º 5
0
 private void AddDefaultConnectionStringCollectionNode()
 {
     ConnectionStringCollectionNode node = new ConnectionStringCollectionNode(databaseSettings.ConnectionStrings);
     Nodes.AddWithDefaultChildren(node);
 }