目前,我正在学习更多关于Linq到实体的知识--特别是目前关于急切和延迟加载的知识。
proxy.User.Include("Role").First(u => u.UserId == userId)这应该是用来加载用户,以及用户拥有的任何角色。我有一个问题,但我也有一个问题。它只是为了解L2E而创建的一个简单的模型
我的印象是,这是为了使事物强大的类型-那么我为什么要写“角色”呢?如果我更改了表的名称,就不会产生编译错误.
我的错误是:
The specified type member 'Roles' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.下面的解决方案允许我现在编写代码:
proxy.User.Include(u => u.Role).First(u => u.UserId == userId)这更好!
发布于 2009-10-24 13:34:46
loading.
https://stackoverflow.com/questions/1618016
复制相似问题