/// <summary> /// Initializes a new instance of the <see cref="DatabaseDriver" /> class /// </summary> /// <param name="providerType">The provider</param> /// <param name="connectionString">The base database connection string</param> public DatabaseDriver(string providerType, string connectionString) { this.Connection = DatabaseConfig.GetOpenConnection(providerType, connectionString); }
/// <summary> /// Initializes a new instance of the <see cref="DatabaseDriver" /> class /// </summary> public DatabaseDriver() { this.Connection = DatabaseConfig.GetOpenConnection(); }
/// <summary> /// Gets a database connection based on configuration values /// </summary> /// <typeparam name="T"> The type of connection client</typeparam> /// <param name="provider"> The custom provider. </param> /// <param name="connectionString"> The connection String. </param> /// <returns> The database connection client </returns> public static IDbConnection GetOpenConnection <T>(IProvider <T> provider, string connectionString = "") where T : class { return((IDbConnection)provider.SetupDataBaseConnection(!string.IsNullOrWhiteSpace(connectionString) ? connectionString : DatabaseConfig.GetConnectionString())); }
/// <summary> /// Gets a database connection based on configuration values /// </summary> /// <returns>The database connection</returns> public static IDbConnection GetOpenConnection() { return(GetOpenConnection(DatabaseConfig.GetProviderTypeString(), DatabaseConfig.GetConnectionString())); }
/// <summary> /// Get the database connection /// </summary> /// <returns>The database connection</returns> protected virtual IDbConnection GetDataBaseConnection() { return(DatabaseConfig.GetOpenConnection()); }