'I added a new table in SSMS, and added a new DBSet to my DBContext instance, but am getting an invalid object error
I have a database connected to my .Net Core project and added a new table to the database. I added the corresponding model with the class/entities in the project and added a new DBSet to my DBContext Instance, but when I try to query the new table in my program, I get the following error: Microsoft.Data.SqlClient.SqlException: 'Invalid object name 'SalesOrdersNonLegacies'.'
In SSMS, the new table is called dbo.SalesOrdersNonLegacy (all of the tables are in the dbo schema, but the dbo isn't included in the DBSet declaration) and I added the DBSet as follows:
public DbSet<SalesOrdersNonLegacy> SalesOrdersNonLegacies { get; set; }
I added a model SalesOrdersNonLegacy.cs with the respective entities. Am I missing something obvious? I rebuilt the project containing the model and DBContext. Is it a permission error just adding a new table willie nillie?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
