SQLITE is a single-user local file based DB unlike multi-user server based DB systems, like MySql, Sql Server, etc... it is far less restrictive.
So, if it is a complete backup/restore, simply rename to backup, and delete & rename to restore.
UPDATE: Here is a quick example of how to do it:
class Program
{
private static readonly string filePath = Environment.CurrentDirectory;
static void Main(string[] args)
{
var filename = "mock.db";
var bkupFilename = Path.GetFileNameWithoutExtension(filename) + ".bak";
CreateDB(filePath, filename);
BackupDB(filePath, filename, bkupFilename);
RestoreDB(filePath, bkupFilename, filename, true);
}
private static void RestoreDB(string filePath, string srcFilename, string destFileName, bool IsCopy = false)
{
var srcfile = Path.Combine(filePath, srcFilename);
var destfile = Path.Combine(filePath, destFileName);
if (File.Exists(destfile)) File.Delete(destfile);
if (IsCopy)
BackupDB(filePath, srcFilename, destFileName);
else
File.Move(srcfile, destfile);
}
private static void BackupDB(string filePath, string srcFilename, string destFileName)
{
var srcfile = Path.Combine(filePath, srcFilename);
var destfile = Path.Combine(filePath, destFileName);
if (File.Exists(destfile)) File.Delete(destfile);
File.Copy(srcfile, destfile);
}
private static void CreateDB(string filePath, string filename)
{
var fullfile = Path.Combine(filePath, filename);
if (File.Exists(fullfile)) File.Delete(fullfile);
File.WriteAllText(fullfile, "this is the dummy data");
}
}