2
我有两个实体:Student和Class。EF CTP4:“创建模型时无法使用上下文。”
他们彼此之间的许多一对多的关系:
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."
你知道CTP4是过时的版本吗?已经有几个变化的CTP5,现在你可以下载EF 4.1 RC:http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2dc5ddac-5a96-48b2-878d-b9f49d87569a – 2011-03-21 21:16:26
感谢新闻,@拉迪斯拉夫。 – Attilah 2011-03-21 21:17:40