Exemple #1
0
 public ItsDbContextOptions()
 {
     _optionsBuilder = new DbContextOptionsBuilder();
     if (EnvironmentInformation.DatabaseType == DatabaseType.MSSQL)
     {
         _optionsBuilder.UseSqlServer(EnvironmentManager.Configuration.ConnectionString);
     }
     else if (EnvironmentInformation.DatabaseType == DatabaseType.Oracle)
     {
         ITSOracleConfiguration.ConfigureDataSources();
         _optionsBuilder.UseOracle(EnvironmentManager.Configuration.ConnectionString);
     }
     else if (EnvironmentInformation.DatabaseType == DatabaseType.SQLITE)
     {
         _optionsBuilder.UseSqlite(EnvironmentInformation.ConnectionString);
     }
 }
        private ConnectionFactory()
        {
            if (EnvironmentInformation.DatabaseType == DatabaseType.Oracle)
            {
                ITSOracleConfiguration.ConfigureDataSources();
            }

            if (_connections == null)
            {
                _connections = new ConcurrentDictionary <string, ConnectionData>();
            }

            if (_readers == null)
            {
                _readers = new ConcurrentBag <DbDataReader>();
            }

            StartTaskWatcher();
        }