コード例 #1
0
		/// <summary>
		/// Initialize.
		/// </summary>
		/// <param name="name">Provider name.</param>
		/// <param name="config">Config.</param>
		public override void Initialize(string name, NameValueCollection config)
		{
			if (config == null)
				throw new ArgumentNullException("config");

			base.Initialize(name, config);

			_connectionString = new ConnectionStringSettings()
			{
				ConnectionString = config["connectionString"],
				ProviderName = config["providerName"] ?? ""
			};

			if (String.IsNullOrEmpty(_connectionString.ConnectionString))
			{
				string connectionStringName = config["connectionStringName"];
				if (connectionStringName == null || connectionStringName.Length == 0)
					ThrowConnectionNameNotSpecified();

				_connectionString = ConfigurationManager.ConnectionStrings[connectionStringName];
				if (_connectionString == null)
					ThrowConnectionStringNotFound(connectionStringName);
			}

			_holder = _connectionString == null || String.IsNullOrEmpty(_connectionString.ProviderName)
				? OracleDbHolder.GetOracleDbHolder(OracleClientFactory.Instance, _connectionString.ConnectionString)
				: OracleDbHolder.GetOracleDbHolder(_connectionString.ProviderName, _connectionString.ConnectionString);

			_parser = new OracleAPQueryParser();
		}
コード例 #2
0
        /// <summary>
        /// Initialize.
        /// </summary>
        /// <param name="name">Provider name.</param>
        /// <param name="config">Config.</param>
        public override void Initialize(string name, NameValueCollection config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            base.Initialize(name, config);

            _connectionString = new ConnectionStringSettings()
            {
                ConnectionString = config["connectionString"],
                ProviderName     = config["providerName"] ?? ""
            };

            if (String.IsNullOrEmpty(_connectionString.ConnectionString))
            {
                string connectionStringName = config["connectionStringName"];
                if (connectionStringName == null || connectionStringName.Length == 0)
                {
                    ThrowConnectionNameNotSpecified();
                }

                _connectionString = ConfigurationManager.ConnectionStrings[connectionStringName];
                if (_connectionString == null)
                {
                    ThrowConnectionStringNotFound(connectionStringName);
                }
            }

            _holder = _connectionString == null || String.IsNullOrEmpty(_connectionString.ProviderName)
                                ? OracleDbHolder.GetOracleDbHolder(OracleClientFactory.Instance, _connectionString.ConnectionString)
                                : OracleDbHolder.GetOracleDbHolder(_connectionString.ProviderName, _connectionString.ConnectionString);

            _parser = new OracleAPQueryParser();
        }