【发布时间】:2013-12-17 15:14:24
【问题描述】:
我正在尝试将数据从 LocalDb 获取到我的 MVC 控制器中。我试过这个:
UsersContext db = new UsersContext();
var users = db.UserProfiles.Where(u => u.UserId == WebSecurity.CurrentUserId)
.Include(u => u.LastName).ToList();
它返回这个错误:
指定的包含路径无效。实体类型 'ChatProj.Models.UserProfile' 未声明导航属性 名称为“姓氏”。
Here is a picture of my localDb and model.
知道为什么它不起作用吗?
【问题讨论】:
-
我宁愿建议你阅读这篇文章 stackoverflow.com/questions/3356541/…>
标签: c# linq entity-framework