I have a console application that is using code first Entity Framework 4.3.1. I created a class, a DbContext, a DbSet, and I have a database connection.
The issue is that I mispelled the table name and the program threw an error. I changed the name in the DbSet and the system keeps throwing the same error that has the old name.
Example:
public DbSet<SHIPPER> SHIPPERs { get; set; }
This could not find the SHIPPERs table in SQL server. No problem. I changed it to
public DbSet<SHIPPER> SHIPPER { get; set; }
and I get Invalid object name ‘dbo.SHIPPERs’.”
I did a search in Visual Studio for SHIPPERs and nothing was returned. What am I missing?
Note: I created another DbSet for a different table and that works.
The problem was with pluralization. Add the following code inside of your DbContext class to fix the issue: