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.


Iqra AliRank #1,220 · 1.5K reputationPosted Jun 22, 2015, 9:26 AM EDT
ketan lohpatre95 reputationPosted Dec 20, 2016, 1:50 AM EST
public class Department
{
[Key]
public int deptID { get; set; }
public string deptName { get; set; }
public List
}
Rajkiran SwainRank #165 · 14.4K reputationPosted Nov 11, 2017, 9:46 PM EST