Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message in Maui app - "no such table" #161

Closed
blmiles opened this issue Dec 6, 2024 · 0 comments
Closed

Error message in Maui app - "no such table" #161

blmiles opened this issue Dec 6, 2024 · 0 comments

Comments

@blmiles
Copy link

blmiles commented Dec 6, 2024

Hello,

I have followed your sample to a T and the app builds, launches, dnconection is made, AppDbContext created/instantiated, passes through to the VMs etc. All that seems to be ok.

But when I try a basic operation like List items = await context.TodoItems.ToListAsync(cancellationToken);
I get an error citing "no such table".

I've tried with inheriting either DbContext(options) or OfflineDbContext(options) as per your documentation and looked through all code but cannot see where it would actually CREATE the table.

public class AppDbContext(DbContextOptions<AppDbContext> options) : DbContext(options) // OfflineDbContext(options)
    {        
    public DbSet<TodoItem> TodoItems => Set<TodoItem>();

... 

}

I know with SQLLite we need to do something LIKE this
var result = await Database.CreateTableAsync<TodoItem>();
OR is this line in the AppDbContext supposed to set the base class to create the table?
public DbSet<TodoItem> TodoItems => Set<TodoItem>();

This ought to be a quick fix if I'm missing something...

thanks for any help.

@blmiles blmiles closed this as completed Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant