Adding SQLite to the .NET MAUI application

Adding SQLite to the .NET MAUI application

11 December 2021

Buy Me A Coffee

Almost every application needs to store data. Today I will show you how to connect SQLite to the .NET MAUI application.

First of all, we need to install NuGet packages:

Then create repository class:

It's up to you how you initialize the database and which methods to implement.

To use the repository update the MainPage:

Important part for iOS

For iOS/MacCatalyst we need to set the SQLite provider. We can do it in AppDelegate:

.NET MAUI Sqlite

The full code can be found on GitHub.

The .NET MAUI Blazor sample can be found on GitHub.

The sample with EntityFramework Core can be found on GitHub.

Buy Me A Coffee

Related:

Loading MudBlazor components dynamically at runtime in .NET MAUI

Learn how to dynamically load and use MudBlazor components in your .NET MAUI application at runtime, enhancing flexibility and customization.

Take Your .NET MAUI Testing to the Next Level with Maestro

Discover how Maestro can elevate your .NET MAUI app testing with declarative flows, cross-platform support, and visual test creation.

An unhandled error has occurred. Reload

🗙