示例#1
0
        public DatabaseViewsProvider(
            IDatabaseConnectionProvider databaseConnectionProvider,
            IDatabaseConnectionStringProvider connectionStringProvider)
        {
            _databaseConnectionProvider = Preconditions.ThrowIfNull(
                databaseConnectionProvider, nameof(databaseConnectionProvider));

            Preconditions.ThrowIfNull(connectionStringProvider, nameof(connectionStringProvider));
            _connectionString = connectionStringProvider.GetConnectionString();
        }
示例#2
0
        /// <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);
        }
示例#3
0
 /// <summary>
 /// Gets the identification value for the ODS currently in context.
 /// </summary>
 /// <returns>The identification value.</returns>
 public int GetInstanceIdentification()
 {
     return(odsDatabaseConnectionStringProvider.GetConnectionString()
            .GetHashCode());
 }
示例#4
0
 public Task <IEnumerable <EducationOrganizationIdentifiers> > GetAllEducationOrganizationIdentifiers()
 {
     return
         (Task.Run(() => _resultsByConnectionString[_connectionStringProvider.GetConnectionString()]));
 }