I am trying to do this How to pack existing sqlite database on my .net maui app. I found an way here.
How to pack existing SQLite Database in MAUI app
I could not comment on this question so that is why i ask this.
I understand that i need to copy the database to the resources/raw folder.
In a database class i have this from a sample
using SQLite;
using TodoSQLite.Models;
namespace TodoSQLite.Data;
public class TodoItemDatabase
{
SQLiteAsyncConnection Database;
public TodoItemDatabase()
{
}
async Task Init()
{
if (Database is not null)
return;
Database = new SQLiteAsyncConnection(Constants.DatabasePath, Constants.Flags);
var result = await Database.CreateTableAsync<TodoItem>();
}
Where do i put this code. And do i change aboutassets.txt to the database name.
async Task LoadMauiAsset()
{
using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt");
using var reader = new StreamReader(stream);
var contents = reader.ReadToEnd();
}