Hangfire.Mongo.Tests.Utils.ConnectionUtils.GetDatabaseName C# (CSharp) Method

GetDatabaseName() public static method

public static GetDatabaseName ( ) : string
return string
        public static string GetDatabaseName()
        {
            return Environment.GetEnvironmentVariable(DatabaseVariable) ?? DefaultDatabaseName;
        }

Usage Example

Exemplo n.º 1
0
 private static void RecreateDatabaseAndInstallObjects()
 {
     try
     {
         var client         = new MongoClient(ConnectionUtils.GetConnectionString());
         var database       = client.GetDatabase(ConnectionUtils.GetDatabaseName());
         var storageOptions = new MongoStorageOptions();
         var names          = MongoMigrationManager.RequiredSchemaVersion.CollectionNames(storageOptions.Prefix);
         foreach (var name in names.Where(n => !n.EndsWith(".schema")))
         {
             var collection = database.GetCollection <BsonDocument>(name);
             if (name.EndsWith(".signal"))
             {
                 CleanSignalCollection(collection);
             }
             else
             {
                 CleanCollection(collection);
             }
         }
     }
     catch (MongoException ex)
     {
         throw new InvalidOperationException("Unable to cleanup database.", ex);
     }
 }
All Usage Examples Of Hangfire.Mongo.Tests.Utils.ConnectionUtils::GetDatabaseName