Skip to content

Instantly share code, notes, and snippets.

@axemastabloggists
Created November 4, 2018 16:59
Show Gist options
  • Save axemastabloggists/a541fda667c4f20e74876e1467739e1b to your computer and use it in GitHub Desktop.
Save axemastabloggists/a541fda667c4f20e74876e1467739e1b to your computer and use it in GitHub Desktop.
Data Persistence Part 2 - Gist 2
using System;
using System.IO;
using SQLite;
namespace DataPersistence.Sqlite.Database.Private
{
/// <summary>
/// DatabaseAccess - Accesses the SQLite Database
/// </summary>
public class DatabaseAccess : IDatabaseAccess
{
#region ISQLite Implementation
/// <summary>
/// Returns a connection to the sqlite database
/// </summary>
/// <returns></returns>
public SQLiteConnection GetConnection()
{
//Use constants for extra brownie points!
var filename = "MyAppsDatabase"; //SQLiteConstants.DatabaseName;
var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
var path = Path.Combine(documentsPath, filename);
var connection = new SQLiteConnection(path, true);
return connection;
}
#endregion ISQLite Implementation
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment