Skip to content

Commit f74dbda

Browse files
committed
2 parents eac0b2b + d2b00c1 commit f74dbda

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Also add one of the https://github.com/ericsink/SQLitePCL.raw package of your ch
1111

1212
And call this statup function in each of your platform projects:
1313

14-
```
14+
```csharp
1515
SQLitePCL.Batteries_V2.Init()
1616
```
1717

@@ -28,7 +28,7 @@ For a simple key/value store based on sqlite, or a drop-in replacement (alternat
2828

2929
* Multiple primary key support
3030
Ex:
31-
```
31+
```csharp
3232
public class PrivacyGroupItem
3333
{
3434
[PrimaryKey]
@@ -168,3 +168,16 @@ The T in `db.Query<T>` specifies the object to create for each row. It can be a
168168
return db.Query<Val> ("select 'Price' as 'Money', 'Time' as 'Date' from Valuation where StockId = ?", stock.Id);
169169
}
170170
```
171+
172+
## Encrypting the database file
173+
174+
Add the nuget `SQLitePCLRaw.bundle_e_sqlcipher` to your project containing `sqlite-net2`.
175+
176+
Call this right after opening or creating the db, as the 1st instruction.
177+
178+
```csharp
179+
var db = new SQLiteConnection(filePath);
180+
db.Execute($"PRAGMA key = '{key}';");
181+
```
182+
183+
And use the db as usual.

0 commit comments

Comments
 (0)