【发布时间】:2013-01-25 15:47:32
【问题描述】:
dbEntities db = new dbEntities();
foreach (ttCategory c in db.ttCategories)
{
var tags=(from t in db.ttproduktes where t.ttCategories.Contains(c) select t.ttTags);
foreach (ttTag t in tags) // here it says:
// Unable to create a constant value - only primitive types
{
t.ToString();
}
}
我做错了什么?
【问题讨论】:
-
请提供有关您的架构的更多信息(最好更改您的类型名称以遵循正常的 .NET 命名约定)。
-
似乎 ttTag(在 foreach 中)不是有效类型。
-
"ttCategory" 和 "ttTag" 是你的类名吗?在 foreach 中将其替换为“var”。
-
这可能是相关的? stackoverflow.com/questions/879411/…
标签: c# linq entity-framework