On My DB context class I have code like this
modelBuilder.Entity("WebApplication10.Data.JobCategory", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd();
b.Property<string>("JobCategoryName");
b.Property<int>("JobCategoryParentID");
b.Property<string>("jobCategoryDetails");
b.HasKey("ID");
b.ToTable("JobCategory");
});
And on my controller
private readonly ApplicationDbContext _context;
public IActionResult Index()
{
return View( _context.JobCategory.ToList());
}
but on my controller class I get an error like this
An exception of type 'System.NullReferenceException' occurred in WebApplication10.dll but was not handled in user code
Additional information: Object reference not set to an instance of an object. Can anyone point out what i am doing wrong?