-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSQLiteSetting.cs
More file actions
45 lines (43 loc) · 1.51 KB
/
SQLiteSetting.cs
File metadata and controls
45 lines (43 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#nullable enable
namespace TimeClockApp.Shared
{
/// <summary>
/// Class holds the FilePath + filename of the SQLite database.
/// </summary>
public static class SQLiteSetting
{
#if MIGRATION
/// <summary>
/// File name (only) of the SQLite Database used by the EFMigrator for setting up EF migrations.
/// </summary>
/// <remarks>Does not include path.</remarks>
private const string sQLiteDbFileName = "BaseTimeClock.db3";
#else
/// <summary>
/// File name (only) of the SQLite Database used by the app.
/// </summary>
/// <remarks>Does not include path.</remarks>
private const string sQLiteDbFileName = "TimeClockAppDB-2.db3";
#endif
/// <summary>
/// Property for the full file path to the SQLite Database
/// </summary>
private static string SQLiteDBPath { get; set; } = string.Empty;
/// <summary>
/// Method for getting the full file path to SQLite Database
/// </summary>
/// <returns>string value of the file path to the SQLite Database</returns>
public static string GetSQLiteDBPath()
{
if (SQLiteDBPath == string.Empty)
{
#if MIGRATION
SQLiteDBPath = System.IO.Path.Combine("../", sQLiteDbFileName);
#else
SQLiteDBPath = System.IO.Path.Combine(Microsoft.Maui.Storage.FileSystem.Current.AppDataDirectory, sQLiteDbFileName);
#endif
}
return SQLiteDBPath;
}
}
}