Skip to content

Commit 2f9fcaf

Browse files
committed
Add Documentation for Settings
1 parent 41dea72 commit 2f9fcaf

File tree

1 file changed

+152
-1
lines changed

1 file changed

+152
-1
lines changed

README.md

Lines changed: 152 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,154 @@
1+
![License](https://img.shields.io/github/license/ReactiveMarbles/CacheDatabase.svg) [![Build](https://github.com/reactivemarbles/CacheDatabase/actions/workflows/ci-build.yml/badge.svg)](https://github.com/reactivemarbles/CacheDatabase/actions/workflows/ci-build.yml)
2+
13
# CacheDatabase
24

3-
A reimplementation of (Akavache)[https://github.com/reactiveui/akavache] using the SQLite framework by (Frank Krueger](https://github.com/praeclarum/sqlite-net).
5+
A reimplementation of [Akavache](https://github.com/reactiveui/akavache) using the SQLite framework by [Frank Krueger](https://github.com/praeclarum/sqlite-net).
6+
7+
ReactiveMarbles.CacheDatabase.EncryptedSqlite3
8+
![Nuget](https://img.shields.io/nuget/dt/ReactiveMarbles.CacheDatabase.EncryptedSqlite3?color=pink&style=plastic) [![NuGet](https://img.shields.io/nuget/v/ReactiveMarbles.CacheDatabase.EncryptedSqlite3.svg?style=plastic)](https://www.nuget.org/packages/ReactiveMarbles.CacheDatabase.EncryptedSqlite3)
9+
10+
ReactiveMarbles.CacheDatabase.Sqlite3
11+
![Nuget](https://img.shields.io/nuget/dt/ReactiveMarbles.CacheDatabase.Sqlite3?color=pink&style=plastic) [![NuGet](https://img.shields.io/nuget/v/ReactiveMarbles.CacheDatabase.Sqlite3.svg?style=plastic)](https://www.nuget.org/packages/ReactiveMarbles.CacheDatabase.Sqlite3)
12+
13+
# CacheDatabase.Settings
14+
15+
A settings database for use with installable applications to provide persistent settings which are located one level down from the application folder making updates less painfull.
16+
17+
## Example Application settings code
18+
```c#
19+
public class ViewSettings : SettingsBase
20+
{
21+
/// <summary>
22+
/// Initializes a new instance of the <see cref="ViewSettings"/> class.
23+
/// </summary>
24+
public ViewSettings()
25+
: base(nameof(ViewSettings))
26+
{
27+
}
28+
29+
/// <summary>
30+
/// Gets or sets a value indicating whether [bool test].
31+
/// </summary>
32+
/// <value>
33+
/// <c>true</c> if [bool test]; otherwise, <c>false</c>.
34+
/// </value>
35+
public bool BoolTest
36+
{
37+
get => GetOrCreate(true); set => SetOrCreate(value);
38+
}
39+
40+
/// <summary>
41+
/// Gets or sets the byte test.
42+
/// </summary>
43+
/// <value>
44+
/// The byte test.
45+
/// </value>
46+
public byte ByteTest
47+
{
48+
get => GetOrCreate((byte)123); set => SetOrCreate(value);
49+
}
50+
51+
/// <summary>
52+
/// Gets or sets the short test.
53+
/// </summary>
54+
/// <value>
55+
/// The short test.
56+
/// </value>
57+
public short ShortTest
58+
{
59+
get => GetOrCreate((short)16); set => SetOrCreate(value);
60+
}
61+
62+
/// <summary>
63+
/// Gets or sets the int test.
64+
/// </summary>
65+
/// <value>
66+
/// The int test.
67+
/// </value>
68+
public int IntTest
69+
{
70+
get => GetOrCreate(1); set => SetOrCreate(value);
71+
}
72+
73+
/// <summary>
74+
/// Gets or sets the long test.
75+
/// </summary>
76+
/// <value>
77+
/// The long test.
78+
/// </value>
79+
public long LongTest
80+
{
81+
get => GetOrCreate(123456); set => SetOrCreate(value);
82+
}
83+
84+
/// <summary>
85+
/// Gets or sets the string test.
86+
/// </summary>
87+
/// <value>
88+
/// The string test.
89+
/// </value>
90+
public string? StringTest
91+
{
92+
get => GetOrCreate("TestString"); set => SetOrCreate(value);
93+
}
94+
95+
/// <summary>
96+
/// Gets or sets the float test.
97+
/// </summary>
98+
/// <value>
99+
/// The float test.
100+
/// </value>
101+
public float FloatTest
102+
{
103+
get => GetOrCreate(2.2f); set => SetOrCreate(value);
104+
}
105+
106+
/// <summary>
107+
/// Gets or sets the double test.
108+
/// </summary>
109+
/// <value>
110+
/// The double test.
111+
/// </value>
112+
public double DoubleTest
113+
{
114+
get => GetOrCreate(23.8d); set => SetOrCreate(value);
115+
}
116+
117+
/// <summary>
118+
/// Gets or sets the enum test.
119+
/// </summary>
120+
/// <value>
121+
/// The enum test.
122+
/// </value>
123+
public EnumTestValue EnumTest
124+
{
125+
get => GetOrCreate(EnumTestValue.Option1); set => SetOrCreate(value);
126+
}
127+
}
128+
```
129+
130+
## Create an instance or get existing Settings SettingsCache
131+
132+
Install ReactiveMarbles.CacheDatabase.Settings
133+
![Nuget](https://img.shields.io/nuget/dt/ReactiveMarbles.CacheDatabase.Settings?color=pink&style=plastic) [![NuGet](https://img.shields.io/nuget/v/ReactiveMarbles.CacheDatabase.Settings.svg?style=plastic)](https://www.nuget.org/packages/ReactiveMarbles.CacheDatabase.Settings)
134+
135+
```c#
136+
var viewSettings = await AppInfo.SetupSettingsStore<ViewSettings>();
137+
```
138+
## To Create an instance or get existing EncryptedSettings SettingsCache
139+
140+
Install ReactiveMarbles.CacheDatabase.EncryptedSettings
141+
![Nuget](https://img.shields.io/nuget/dt/ReactiveMarbles.CacheDatabase.EncryptedSettings?color=pink&style=plastic) [![NuGet](https://img.shields.io/nuget/v/ReactiveMarbles.CacheDatabase.EncryptedSettings.svg?style=plastic)](https://www.nuget.org/packages/ReactiveMarbles.CacheDatabase.EncryptedSettings)
142+
```c#
143+
var viewSettings = await AppInfo.SetupSettingsStore<ViewSettings>("SECURE_PASSWORD");
144+
```
145+
## To Delete the instance of the SettingsCache
146+
```c#
147+
await AppInfo.DeleteSettingsStore<ViewSettings>();
148+
```
149+
## To Close the SettingsCache upon application exit
150+
```c#
151+
await AppInfo.DisposeSettingsStore<ViewSettings>();
152+
```
153+
154+
Multiple SettingsCache's can be created, each SettingsCache will have a SettingsCache database created with the name of the SettingsCache class.

0 commit comments

Comments
 (0)