我有两个实体:学生和班级。
它们之间存在多对多的关系:
class Student
{
ICollection<Class> Classes{get;set;}
}
class Class
{
ICollection<Student> Students{get;set;}
}
当我尝试执行以下语句时:
return _db.Students.Where(s => s.Email == email).FirstOrDefault();
我收到此错误消息:
"The context cannot be used while the model is being created."