コード例 #1
0
        /// <summary>
        /// Builds an instance of the concrete subtype of <see cref="T:Microsoft.Practices.EnterpriseLibrary.Data.Database"/> 
        /// the receiver knows how to build, based on the provided connection string and any configuration information 
        /// that might be contained by the <paramref name="configurationSource"/>.
        /// </summary>
        /// <param name="name">The name for the new database instance.</param>
        /// <param name="connectionStringSettings">The connection string for the new database instance.</param>
        /// <param name="configurationSource">The source for any additional configuration information.</param>
        /// <returns>
        /// The new database instance.
        /// </returns>
        public Database Assemble(string name, ConnectionStringSettings connectionStringSettings,
                                 IConfigurationSource configurationSource) {
            if(IsDebugEnabled)
                log.Debug("EnterpriseLibrary용 OracleProvider 인스턴스를 빌드합니다... name=[{0}]", name);

            var settings = OracleConnectionSettings.GetSettings(configurationSource);

            if(settings != null) {
                var data = settings.OracleConnectionsData.Get(name);

                if(data != null) {
                    var packages = new IOraclePackage[data.Packages.Count];
                    var num = 0;

                    foreach(var package in data.Packages) {
                        packages[num++] = package;
                    }
                    return new OracleDatabase(connectionStringSettings.ConnectionString);
                }
            }

            if(IsDebugEnabled)
                log.Debug("OracleDatabase를 생성합니다. connectionString=[{0}]", connectionStringSettings.ConnectionString);

            return new OracleDatabase(connectionStringSettings.ConnectionString);
        }
コード例 #2
0
        /// <summary>
        /// Builds an instance of the concrete subtype of <see cref="T:Microsoft.Practices.EnterpriseLibrary.Data.Database"/>
        /// the receiver knows how to build, based on the provided connection string and any configuration information
        /// that might be contained by the <paramref name="configurationSource"/>.
        /// </summary>
        /// <param name="name">The name for the new database instance.</param>
        /// <param name="connectionStringSettings">The connection string for the new database instance.</param>
        /// <param name="configurationSource">The source for any additional configuration information.</param>
        /// <returns>
        /// The new database instance.
        /// </returns>
        public Database Assemble(string name, ConnectionStringSettings connectionStringSettings,
                                 IConfigurationSource configurationSource)
        {
            if (IsDebugEnabled)
            {
                log.Debug("EnterpriseLibrary용 OracleProvider 인스턴스를 빌드합니다... name=[{0}]", name);
            }

            var settings = OracleConnectionSettings.GetSettings(configurationSource);

            if (settings != null)
            {
                var data = settings.OracleConnectionsData.Get(name);

                if (data != null)
                {
                    var packages = new IOraclePackage[data.Packages.Count];
                    var num      = 0;

                    foreach (var package in data.Packages)
                    {
                        packages[num++] = package;
                    }
                    return(new OracleDatabase(connectionStringSettings.ConnectionString));
                }
            }

            if (IsDebugEnabled)
            {
                log.Debug("OracleDatabase를 생성합니다. connectionString=[{0}]", connectionStringSettings.ConnectionString);
            }

            return(new OracleDatabase(connectionStringSettings.ConnectionString));
        }
コード例 #3
0
        void IContainerPolicyCreator.CreatePolicies(
            IPolicyList policyList,
            string instanceName,
            ConfigurationElement configurationObject,
            IConfigurationSource configurationSource)
        {
            ConnectionStringSettings castConfigurationObject = (ConnectionStringSettings)configurationObject;
            IList <IOraclePackage>   packages = new IOraclePackage[0];
            OracleConnectionSettings oracleConnectionSettings = OracleConnectionSettings.GetSettings(configurationSource);

            if (oracleConnectionSettings != null)
            {
                OracleConnectionData oracleConnectionData
                    = oracleConnectionSettings.OracleConnectionsData.Get(castConfigurationObject.Name);
                if (oracleConnectionData != null)
                {
                    packages = new List <IOraclePackage>(from op in oracleConnectionData.Packages select(IOraclePackage) op);
                }
            }
            new PolicyBuilder <OracleDatabase, ConnectionStringSettings>(
                instanceName,
                castConfigurationObject,
                c => new OracleDatabase(c.ConnectionString, packages))
            .AddPoliciesToPolicyList(policyList);
        }
コード例 #4
0
ファイル: OdpNetDatabase.cs プロジェクト: debop/NFramework
        public OdpNetDatabase(string connectionString, IOraclePackage[] packages)
            : base(connectionString ?? AdoTool.DefaultConnectionStringSettings.ConnectionString, OracleClientFactory.Instance) {
            connectionString = connectionString ?? AdoTool.DefaultConnectionStringSettings.ConnectionString;

            if(log.IsInfoEnabled)
                log.Info("Microsoft EntLib DAAB 방식의 odpNetDatabase 인스턴스를 생성했습니다. connectionString=[{0}]", connectionString);

            packages.ShouldNotBeNull("packages");
            _packages = packages;
        }
コード例 #5
0
 public Database Assemble(string name, ConnectionStringSettings connectionStringSettings, IConfigurationSource configurationSource)
 {
     OracleConnectionSettings settings = OracleConnectionSettings.GetSettings(configurationSource);
     if (settings != null)
     {
         OracleConnectionData data = settings.OracleConnectionsData.Get(name);
         if (data != null)
         {
             IOraclePackage[] packages = new IOraclePackage[data.Packages.Count];
             int num = 0;
             foreach (IOraclePackage package in data.Packages)
             {
                 packages[num++] = package;
             }
             return new OracleDatabase(connectionStringSettings.ConnectionString, packages);
         }
     }
     return new OracleDatabase(connectionStringSettings.ConnectionString);
 }
コード例 #6
0
        public Database Assemble(string name, ConnectionStringSettings connectionStringSettings, IConfigurationSource configurationSource)
        {
            OracleConnectionSettings oracleConnectionSettings = OracleConnectionSettings.GetSettings(configurationSource);

            if (oracleConnectionSettings != null)
            {
                OracleConnectionData oracleConnectionData = oracleConnectionSettings.OracleConnectionsData.Get(name);
                if (oracleConnectionData != null)
                {
                    IOraclePackage[] packages = new IOraclePackage[oracleConnectionData.Packages.Count];
                    int i = 0;
                    foreach (IOraclePackage package in oracleConnectionData.Packages)
                    {
                        packages[i++] = package;
                    }
                    return(new OracleDatabase(connectionStringSettings.ConnectionString, packages));
                }
            }
            return(new OracleDatabase(connectionStringSettings.ConnectionString));
        }