/// <summary> /// Initializes a new instance of the DataLayerBase class. /// </summary> /// <param name="databaseType">Data base type and create this class</param> /// <param name="dbConnection">Connection specific SQL server type</param> /// <param name="parameterPrefix">Paramether prefix specific SQL server</param> /// <param name="parameterNames">Parameter names</param> protected DataLayerBase(DatabaseTypes databaseType, IDbConnection dbConnection, string parameterPrefix, ConnectionParameterNames parameterNames) { if (databaseType == DatabaseTypes.None) { throw new ArgumentException("constructor DataLayerBase(). DatabaseType can not be 'None'!"); } _dataBaseType = databaseType; if (dbConnection == null) { throw new ArgumentNullException("dbConnection", "Can not be Null!"); } _connection = dbConnection; _propertyBindingFlag = BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance; // Create ConnectionString _connectionString = new DBConnectionString(databaseType, parameterNames); _connectionString.Changed += new EventHandler(ConnectionString_Changed); _lastError = string.Empty; // This a default initialization //_reRaiseException = false; _keepConnection = true; _inNotReconnected = true; // Set specific Prameter prefix _paramPrefix = parameterPrefix; // Create command CreateCommand(); // Set command type _command.CommandType = CommandType.Text; _defaultCommandType = CommandType.Text; }
public DBConnection(IDBProvider dbProvider, IDBConnectionString ConnectionString) { this.CommandTimeout = 30; this._dbProvider = dbProvider; _conn = (System.Data.IDbConnection)_dbProvider.CreateConnection(ConnectionString.GetValue()); }