Skip to content

Commit 0575b9d

Browse files
committed
Updated MAUI package readme.
1 parent e4f0463 commit 0575b9d

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

PowerSync/PowerSync.Maui/README.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,47 @@
11
# PowerSync SDK .NET MAUI
22

3+
This package provides .NET Multi-platform App UI (MAUI) integration for PowerSync, designed to work with the PowerSync.Common package for cross-platform mobile and desktop applications.
4+
5+
## ⚠️ Project Status & Release Note
6+
7+
This package is currently in an alpha state, intended strictly for testing. Expect breaking changes and instability as development continues.
8+
9+
Do not rely on this package for production use.
10+
11+
## Installation
12+
13+
This package is published on [NuGet](https://www.nuget.org/packages/PowerSync.Maui) and requires PowerSync.Common to also be installed.
14+
15+
```bash
16+
dotnet add package PowerSync.Maui --prerelease
17+
dotnet add package PowerSync.Common --prerelease
18+
```
19+
320
## Usage
421

5-
TBD Factory Example
22+
Initialization differs slightly when using MAUI.
23+
24+
```csharp
25+
26+
private record ListResult(string id, string name, string owner_id, string created_at);
27+
28+
static async Task Main() {
29+
30+
// Ensures the DB file is stored in a platform appropriate location
31+
var dbPath = Path.Combine(FileSystem.AppDataDirectory, "maui-example.db");
32+
var factory = new MAUISQLiteDBOpenFactory(new MDSQLiteOpenFactoryOptions()
33+
{
34+
DbFilename = dbPath
35+
});
36+
37+
var Db = new PowerSyncDatabase(new PowerSyncDatabaseOptions()
38+
{
39+
Database = factory, // Supply a factory
40+
Schema = AppSchema.PowerSyncSchema,
41+
});
42+
43+
await db.Init();
44+
45+
var lists = await db.GetAll<ListResult>("select * from lists");
46+
}
47+
```

0 commit comments

Comments
 (0)