Initial Commit
This commit is contained in:
44
Data/Database.cs
Normal file
44
Data/Database.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DebtMgr.Model;
|
||||
using SQLite.Net;
|
||||
using SQLite.Net.Interop;
|
||||
using SQLite.Net.Platform.Generic;
|
||||
|
||||
namespace DebtMgr.Data
|
||||
{
|
||||
public class Database : SQLiteConnection
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
public Database(ISQLitePlatform sqlitePlatform, string databasePath, bool storeDateTimeAsTicks = true, IBlobSerializer serializer = null, IDictionary<string, TableMapping> tableMappings = null, IDictionary<Type, string> extraTypeMappings = null, IContractResolver resolver = null) : base(sqlitePlatform, databasePath, storeDateTimeAsTicks, serializer, tableMappings, extraTypeMappings, resolver)
|
||||
{
|
||||
}
|
||||
|
||||
public Database(ISQLitePlatform sqlitePlatform, string databasePath, SQLiteOpenFlags openFlags, bool storeDateTimeAsTicks = true, IBlobSerializer serializer = null, IDictionary<string, TableMapping> tableMappings = null, IDictionary<Type, string> extraTypeMappings = null, IContractResolver resolver = null) : base(sqlitePlatform, databasePath, openFlags, storeDateTimeAsTicks, serializer, tableMappings, extraTypeMappings, resolver)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public Database(string databasePath) : base(new SQLitePlatformGeneric(), databasePath)
|
||||
{
|
||||
CreateTables();
|
||||
}
|
||||
|
||||
#region CreateTables
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// <summary> Creates the tables. </summary>
|
||||
///
|
||||
/// <remarks> Andre Beging, 08.09.2017. </remarks>
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
private void CreateTables()
|
||||
{
|
||||
CreateTable<Person>();
|
||||
CreateTable<Transaction>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user