I created an ASP.NET Core web application using the Visual Studio wizard, which generated all the DbContext stuff. I am currently trying to implement the Enum Lookup Table Generator package. The documentation says:
Run
EnumToLookup.Apply()
from your Seed method in either your database initializer or your EF Migrations.
My issue is that my DbContext does not currently use a database initializer.
Where should I run EnumToLookup.Apply()
? Do I need to add a database initializer so that I can override the Seed()
method where the documentation says to put EnumToLookup.Apply()
?
My DbContext looks like this:
namespace WebApplication3.Data
{
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
}
public DbSet<WebApplication3.Models.Restaurant> Restaurant { get; set; }
public DbSet<WebApplication3.Models.Customer> Customer { get; set; }
}
}