using c# entity framework 7 with sqlite, how can I check to see if a table exists and if not create it? Maybe based off a dbset that is in the context? There is no existing database with a migration or anything. The app just creates the database when its not there and I'd like to to also create the tables.
public class Context : DbContext
{
public DbSet<Value> Values { get; set; }
protected override async void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite("Filename=data.db");
//here somewhere?
}
}
If you are not using migrations, you can use this in your app startup procedure:
context.Database.EnsureCreated();
Or with Migrations:
context.Database.Migrate();