Created
November 4, 2018 16:59
-
-
Save axemastabloggists/a541fda667c4f20e74876e1467739e1b to your computer and use it in GitHub Desktop.
Data Persistence Part 2 - Gist 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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