Beispiel #1
0
 public static void CreateDatabase(bool force)
 {
     using (DevelopmentStorageDbDataContext dbContext = DevelopmentStorageDbDataContext.GetDbContext())
     {
         bool flag = dbContext.DatabaseExists();
         if (flag)
         {
             if (force)
             {
                 dbContext.DeleteDatabase();
             }
             else
             {
                 return;
             }
         }
         try
         {
             dbContext.CreateDatabase();
         }
         catch (SqlException sqlException)
         {
             if (flag)
             {
                 throw;
             }
             dbContext.DetachDatabase();
             dbContext.CreateDatabase();
         }
         DevelopmentStorageDbDataContext.ExecuteCommands(dbContext, Resources.ForeignKeys);
         DevelopmentStorageDbDataContext.ExecuteCommands(dbContext, Resources.LastModificationTimeTriggers);
         DevelopmentStorageDbDataContext.ExecuteCommands(dbContext, Resources.BlobSummary);
         DevelopmentStorageDbDataContext.ExecuteCommands(dbContext, Resources.CommitBlockList);
         DevelopmentStorageDbDataContext.ExecuteCommands(dbContext, Resources.QueueFunctions);
         DevelopmentStorageDbDataContext.ExecuteCommands(dbContext, Resources.PageBlob);
     }
 }