Ejemplo n.º 1
0
        /// <summary>
        /// <para>
        /// Add the default child nodes for the current node.
        /// </para>
        /// </summary>
        /// <remarks>
        /// <para>
        /// This will add the default <see cref="DatabaseTypeCollectionNode"/>, <see cref="ConnectionStringCollectionNode"/>, and <see cref="InstanceCollectionNode"/>.
        /// </para>
        /// </remarks>
        protected override void AddDefaultChildNodes()
        {
            base.AddDefaultChildNodes();
            AddDefaultDatabaseTypeCollectionNode();
            AddDefaultConnectionStringCollectionNode();
            AddDefaultInstanceNode();
            InstanceCollectionNode nodes = (InstanceCollectionNode)Hierarchy.FindNodeByType(this, typeof(InstanceCollectionNode));

            if (nodes.Nodes.Count > 0)
            {
                this.DefaultInstanceNode = nodes.Nodes[0] as InstanceNode;
            }
        }
Ejemplo 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();
            InstanceCollectionNode node = Hierarchy.FindNodeByType(this, typeof(InstanceCollectionNode)) as InstanceCollectionNode;

            if (node == null)
            {
                return;
            }
            DefaultInstanceNode = Hierarchy.FindNodeByName(node, databaseSettings.DefaultInstance) as InstanceNode;
            if (instanceNode == null)
            {
                throw new InvalidOperationException(SR.ExceptionInstanceNodeNotFound(databaseSettings.DefaultInstance));
            }
        }
Ejemplo n.º 3
0
        private void GetInstanceCollectionData()
        {
            InstanceCollectionNode node = Hierarchy.FindNodeByType(typeof(InstanceCollectionNode)) as InstanceCollectionNode;

            if (node == null)
            {
                return;
            }

            InstanceDataCollection data = node.InstanceDataCollection;

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

            databaseSettings.Instances.Clear();
            foreach (InstanceData instanceData in data)
            {
                databaseSettings.Instances[instanceData.Name] = instanceData;
            }
        }
Ejemplo n.º 4
0
        private void AddDefaultInstanceNode()
        {
            InstanceCollectionNode node = new InstanceCollectionNode(databaseSettings.Instances);

            Nodes.AddWithDefaultChildren(node);
        }
Ejemplo n.º 5
0
 private void AddDefaultInstanceNode()
 {
     InstanceCollectionNode node = new InstanceCollectionNode(databaseSettings.Instances);
     Nodes.AddWithDefaultChildren(node);
 }