public DatabaseViewsProvider( IDatabaseConnectionProvider databaseConnectionProvider, IDatabaseConnectionStringProvider connectionStringProvider) { _databaseConnectionProvider = Preconditions.ThrowIfNull( databaseConnectionProvider, nameof(databaseConnectionProvider)); Preconditions.ThrowIfNull(connectionStringProvider, nameof(connectionStringProvider)); _connectionString = connectionStringProvider.GetConnectionString(); }
/// <summary> /// Create and open a connection to the Ed-Fi ODS for NHibernate. /// </summary> /// <returns>An open database connection.</returns> public override DbConnection GetConnection() { var connection = Driver.CreateConnection(); try { connection.ConnectionString = _connectionStringProvider.GetConnectionString(); connection.Open(); } catch (Exception) { connection.Dispose(); throw; } return(connection); }
/// <summary> /// Gets the identification value for the ODS currently in context. /// </summary> /// <returns>The identification value.</returns> public int GetInstanceIdentification() { return(odsDatabaseConnectionStringProvider.GetConnectionString() .GetHashCode()); }
public Task <IEnumerable <EducationOrganizationIdentifiers> > GetAllEducationOrganizationIdentifiers() { return (Task.Run(() => _resultsByConnectionString[_connectionStringProvider.GetConnectionString()])); }