我写我自己的对象标签,我想向包含如果.value的发现(我想模拟凡在像SQL)C#的LINQ包含声明
public static List<Question> GetQuestionsIdsWithTags(List<Tag> tags)
{
IEnumerable<Question> res = from t in dataClasses.tags
join
qt in dataClasses.question_to_tags on t.id equals qt.tag_id
join q in dataClasses.questions on qt.question_id equals q.id
where tags.Contains<Tag>(new Tag(t.name))
select new Question(q.text) { };
问题是,如果包含在查询中,我得到
The member 'Core.Literal.Value' has no supported translation to SQL.
其中Literal是Tag的基础。
我该怎么办?
您应该为您使用的ORM框架添加标签。 – CodesInChaos 2011-03-25 14:03:58
你的代码无论如何都不会起作用。标签如何包含标签对象的新实例? – ChrisF 2011-03-25 14:05:13
*** *** ****是在这里声明的吗? – 2011-03-25 14:05:40