public void Build()
        {
            ConnectionStringsSectionNode node = hierarchy.FindNodeByType(typeof(ConnectionStringsSectionNode)) as ConnectionStringsSectionNode;

            if (null == node)
            {
                LogError(hierarchy.RootNode, Resources.ExceptionMissingConnectionStrings);
                return;
            }

            for (int index = 0; index < odp10ConnectionSettings.ODP10ConnectionsData.Count; ++index)
            {
                ODP10ConnectionData          odp10Connection      = odp10ConnectionSettings.ODP10ConnectionsData.Get(index);
                ConnectionStringSettingsNode connectionStringNode = hierarchy.FindNodeByName(node, odp10Connection.Name) as ConnectionStringSettingsNode;
                if (null == connectionStringNode)
                {
                    LogError(node, string.Format(CultureInfo.CurrentUICulture, Resources.ExceptionConnectionStringMissing, odp10Connection.Name));
                    continue;
                }
                ODP10ConnectionElementNode odp10ElementNode = new ODP10ConnectionElementNode();
                foreach (ODP10PackageData packageData in odp10Connection.Packages)
                {
                    odp10ElementNode.AddNode(new ODP10PackageElementNode(packageData));
                }
                connectionStringNode.AddNode(odp10ElementNode);
            }
        }
Esempio n. 2
0
        public ODP10ConnectionSettings Build()
        {
            odp10ConnectionSettings = new ODP10ConnectionSettings();
            IList <ConfigurationNode> connections = hierarchy.FindNodesByType(typeof(OracleConnectionElementNode));

            for (int index = 0; index < connections.Count; ++index)
            {
                ODP10ConnectionData data = new ODP10ConnectionData();
                data.Name = connections[index].Parent.Name;
                foreach (ODP10PackageElementNode node in connections[index].Nodes)
                {
                    data.Packages.Add(node.ODP10PackageElement);
                }
                odp10ConnectionSettings.ODP10ConnectionsData.Add(data);
            }
            return(odp10ConnectionSettings);
        }
        public Database Assemble(string name, ConnectionStringSettings connectionStringSettings, IConfigurationSource configurationSource)
        {
            ODP10ConnectionSettings oracleConnectionSettings = ODP10ConnectionSettings.GetSettings(configurationSource);

            if (oracleConnectionSettings != null)
            {
                ODP10ConnectionData oracleConnectionData = oracleConnectionSettings.ODP10ConnectionsData.Get(name);
                if (oracleConnectionData != null)
                {
                    IODP10Package[] packages = new IODP10Package[oracleConnectionData.Packages.Count];
                    int             i        = 0;
                    foreach (IODP10Package package in oracleConnectionData.Packages)
                    {
                        packages[i++] = package;
                    }

                    return(new ODP10Database(connectionStringSettings.ConnectionString, packages));
                }
            }

            return(new ODP10Database(connectionStringSettings.ConnectionString));
        }