Beispiel #1
0
 public virtual void DropDatabase([CanBeNull] string contextType, [NotNull] Func <string, string, bool> confirmCheck)
 {
     using (var context = CreateContext(contextType))
     {
         var connection = context.Database.GetDbConnection();
         if (confirmCheck(connection.Database, connection.DataSource))
         {
             _logger.Value.LogInformation(DesignCoreStrings.LogDroppingDatabase(connection.Database));
             if (context.Database.EnsureDeleted())
             {
                 _logger.Value.LogInformation(DesignCoreStrings.LogDatabaseDropped(connection.Database));
             }
             else
             {
                 _logger.Value.LogInformation(DesignCoreStrings.LogNotExistDatabase(connection.Database));
             }
         }
         else
         {
             _logger.Value.LogInformation(DesignCoreStrings.Cancelled);
         }
     }
 }