我有以下Linq查询我正在使用实体框架。实体框架linq包括
var res = from a in _db.Articles
from auth in a.Authors
where papers.Contains(a.JoomlaId)
select auth.Institution;
的问题是,我所在的机构类有一个名为的“Type
”类型“InstitutionType
”我需要包括变量,我不知道该怎么做。
我有以下Linq查询我正在使用实体框架。实体框架linq包括
var res = from a in _db.Articles
from auth in a.Authors
where papers.Contains(a.JoomlaId)
select auth.Institution;
的问题是,我所在的机构类有一个名为的“Type
”类型“InstitutionType
”我需要包括变量,我不知道该怎么做。
var res = from a in _db.Articles.Include("Authors")
.Include("Authors.Institution")
.Include("Authors.Institution.Type")
from auth in a.Authors
where papers.Contains(a.JoomlaId)
select auth.Institution;
在_db.Articles \t \t \t \t \t \t \t .INCLUDE(“作者”) 本来应该是'从VAR RES = \t \t \t \t \t \t \t .INCLUDE( “Authors.Institution”) \t \t \t \t \t \t \t .INCLUDE( “Authors.Institution.Type”) \t \t \t \t \t从权威性的a.Authors \t \t \t \t \t其中papers.Contains(a.JoomlaId) \t \t \t \t \t选择auth.Institution;'u能请编辑,所以我可以将其标记为一个答案 – trebor
@toby:已更新我的回答 – Maciej
已标记为已谢谢 – trebor
不要打电话给你变“型”,你的未来的自己会杀了你 – Sayse
你有一个点,我不否认这一点,但如果我把它称为InstitutionType,它会像'Institution.InstitutionType '也不缝合。 – trebor
AssociatedType?我会尝试程序员交流,institutiontype听起来不错,我虽然,它不听起来像一个静态类型 – Sayse