Esempio n. 1
0
 public DatabaseWrapper(OAuth2Parameters authParams)
 {
     try
     {
         Initialize(authParams);
         logger.Debug("Opening database");
         _dbDatabase = _dbcClient.GetDatabase(Constants.DATABASE_NAME);
         if (null == _dbDatabase)
         {
             logger.Info("Database does not exist. Creating it.");
             _dbDatabase = _dbcClient.CreateDatabase(Constants.DATABASE_NAME);
         }
         _bIsInitialized = true;
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Error while trying to connect to the database: {0}", ex.Message);
     }
 }