1. Clément Bourgeois
  2. SQLServerBackupTool

Commits

Clément Bourgeois  committed 31e63f6

Moved the XmlSerializer into BackupsManager

  • Participants
  • Parent commits d3c0bd6
  • Branches master

Comments (0)

Files changed (2)

File SQLServerBackupTool.Web/Controllers/HomeController.cs

View file
  • Ignore whitespace
 using System.Linq;
 using System.Threading.Tasks;
 using System.Web.Mvc;
-using System.Xml.Serialization;
 
 namespace SQLServerBackupTool.Web.Controllers
 {
     public class HomeController : ApplicationController
     {
-        private static readonly XmlSerializer BackupHistoryXmlSerializer = new XmlSerializer(typeof(BackupHistory));
 
-        //
-        // GET: /Home/
+        /**
+         * Index
+         */
+
         public async Task<ActionResult> Index()
         {
             IQueryable<BackupHistory> q = DbContext.History;
             }
         }
 
+        /**
+         * Schema
+         */
+
         public async Task<ActionResult> Schema(string id)
         {
             using (var co = new SqlConnection(GetBackupsConnectionString()))
             {
                 case "xml":
                     var t = new MemoryStream();
-                    BackupHistoryXmlSerializer.Serialize(t, bk);
+                    BackupsManager.XmlSerializer.Serialize(t, bk);
                     t.Position = 0;
                     return File(t, "application/xml");
 

File SQLServerBackupTool.Web/Lib/BackupsManager.cs

View file
  • Ignore whitespace
 using System.Linq;
 using System.Threading.Tasks;
 using System.Web;
+using System.Xml.Serialization;
 
 namespace SQLServerBackupTool.Web.Lib
 {
     public static class BackupsManager
     {
+        public static readonly XmlSerializer XmlSerializer = new XmlSerializer(typeof(BackupHistory));
+
         /// <summary>
         /// Backup implementation logic, asks SQLServer to make a backup, of <see cref="dbName"/>, creates a Zip archive on success, tries to delete the original backup file.
         /// </summary>