예제 #1
0
 /// <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);
 }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DatabaseDriver" /> class
 /// </summary>
 public DatabaseDriver()
 {
     this.Connection = DatabaseConfig.GetOpenConnection();
 }
예제 #3
0
 /// <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()));
 }
예제 #4
0
 /// <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()));
 }
예제 #5
0
 /// <summary>
 /// Get the database connection
 /// </summary>
 /// <returns>The database connection</returns>
 protected virtual IDbConnection GetDataBaseConnection()
 {
     return(DatabaseConfig.GetOpenConnection());
 }