I am learning Mvc, In db context i added one more dbset,it is working fine when it is with one dbset but when i added one more Dbset getting the below error.Kindly suggest me how to work with multiple tables with in one Dbcontext
public class EmployeeContext:DbContext
{
public DbSet
public DbSet
}
error
An exception of type 'System.Data.Entity.ModelConfiguration.ModelValidationException' occurred in EntityFramework.dll but was not handled in user code
Additional information: One or more validation errors were detected during model generation:
MVCP.Models.Department: : EntityType 'Department' has no key defined. Define the key for this EntityType.
Departments: EntityType: EntitySet 'Departments' is based on type 'Department' that has no keys defined.

Rajkiran SwainPosted Nov 12, 2017, 2:46 AM
ketan lohpatrePosted Dec 20, 2016, 6:50 AM
public class Department
{
[Key]
public int deptID { get; set; }
public string deptName { get; set; }
public List
}
Iqra AliPosted Jun 22, 2015, 1:26 PM