我是实体框架的新手,所以我创建了一个小测试项目。我的项目中有以下模型:
class Books
{
public int Id { get; set; }
public string Title { get; set; }
public Author Author { get; set; }
}
class Author
{
public int Id { get; set; }
public string Name { get; set; }
}
现在我想收到相关作者的所有书籍,但它失败了......
using (WFCDbContext db = new WFCDbContext())
{
List<Books> = db.Books.Where(x => x.Author == myAuthorVariable).toList()
}
错误信息:
在此上下文中仅支持原始类型或枚举类型。
相关分类