aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Core
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2019-11-05 11:41:45 +0200
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2019-11-05 11:41:45 +0200
commit8c003387a229cb852d318a718b2147cbdd7e2c67 (patch)
tree3117bf0643541166f47e532d9a1e052b55d4a20b /Software/Visual_Studio/Tango.Core
parentbf66536228666d733475f4ccdb248e5cec74c0aa (diff)
parent6f1993babfa5e15e73fbe5efb922d837527365f1 (diff)
downloadTango-8c003387a229cb852d318a718b2147cbdd7e2c67.tar.gz
Tango-8c003387a229cb852d318a718b2147cbdd7e2c67.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/Tango.Core')
-rw-r--r--Software/Visual_Studio/Tango.Core/DB/DbManager.cs18
-rw-r--r--Software/Visual_Studio/Tango.Core/IO/TemporaryManager.cs11
2 files changed, 29 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Core/DB/DbManager.cs b/Software/Visual_Studio/Tango.Core/DB/DbManager.cs
index 10a4e26db..1d415fdb1 100644
--- a/Software/Visual_Studio/Tango.Core/DB/DbManager.cs
+++ b/Software/Visual_Studio/Tango.Core/DB/DbManager.cs
@@ -142,6 +142,24 @@ namespace Tango.Core.DB
File.Delete(backupPath);
}
+ public void Backup(String name, String file)
+ {
+ String command = $"BACKUP DATABASE {name} TO DISK = '{file}'";
+ SqlCommand cmd = new SqlCommand(command, _connection);
+ cmd.ExecuteNonQuery();
+ }
+
+ public void Restore(String name, String file)
+ {
+ SetOffline(name);
+
+ String command = $"RESTORE DATABASE {name} FROM DISK = '{file}'";
+ SqlCommand cmd = new SqlCommand(command, _connection);
+ cmd.ExecuteNonQuery();
+
+ SetOnline(name);
+ }
+
public void ClearDb()
{
if (!_connection.ConnectionString.ToLower().Contains("initial catalog"))
diff --git a/Software/Visual_Studio/Tango.Core/IO/TemporaryManager.cs b/Software/Visual_Studio/Tango.Core/IO/TemporaryManager.cs
index 3a02325e6..25ace7dc1 100644
--- a/Software/Visual_Studio/Tango.Core/IO/TemporaryManager.cs
+++ b/Software/Visual_Studio/Tango.Core/IO/TemporaryManager.cs
@@ -124,6 +124,17 @@ namespace Tango.Core.IO
}
/// <summary>
+ /// Creates a new temporary file but does not create it.
+ /// </summary>
+ /// <returns></returns>
+ public virtual TemporaryFile CreateImaginaryFile(String extension = null)
+ {
+ TemporaryFile file = new TemporaryFile(Path.Combine(RootPath, Path.GetRandomFileName() + extension), false);
+ AddItem(file);
+ return file;
+ }
+
+ /// <summary>
/// Deletes all items.
/// </summary>
public virtual void Clean()