What problem does it solve?
Adds a robust, cross-platform local SQLite persistence layer to .NET MAUI applications, removing common pitfalls like wrong package choices, unsafe file paths, multiple connection instances, and data corruption from file operations or missing WAL mode.
Core Features & Use Cases
- Correct package guidance: recommends sqlite-net-pcl and the SQLitePCLRaw bundle to avoid incompatible libraries.
- Singleton async database service: lazy-initialized SQLiteAsyncConnection with DI singleton registration to prevent concurrency issues and data corruption.
- WAL and performance patterns: enables WAL mode, advises transactions for batch writes, indexing, and raw SQL for complex queries to improve concurrency and speed.
- File and platform handling: uses FileSystem.AppDataDirectory for cross-platform paths, notes iOS iCloud considerations, and requires closing the connection before file moves, deletes, or backups.
- Use cases: offline data persistence for MAUI mobile apps, local CRUD storage for MVVM or C# markup projects, and reliable local caches for intermittent-network scenarios.
Quick Start
Register a singleton DatabaseService that lazily creates a single SQLiteAsyncConnection using sqlite-net-pcl, enable WAL, call CreateTableAsync for your models, and use FileSystem.AppDataDirectory for the database file path.