I'm using Bulky from Udemy course for MVC on e-commerce website. My ApplicationDbContext.cs
is:using Bulky.DataAccess;
using Bulky.Models;
using Microsoft.EntityFrameworkCore;
namespace Bulky.DataAcess.Data
{
public class ApplicationDbContext : DbContext
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
{
}
public DbSet<Category> Categories { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Category>().HasData(
new Category { Id = 1, Name = "Action", DisplayOrder = 1 },
new Category { Id = 2, Name = "SciFi", DisplayOrder = 2 },
new Category { Id = 3, Name = "History", DisplayOrder = 3 }
);
}
}
}
and in Migrations:
namespace BulkyWeb.Controllers
{
internal class ApplicationDbContext
{
public object Categories { get; internal set; }
}
}
Any help.Thanks.