linq联合类型推理调用失败 'join'错误[英] linq joint type inference failed to call 'join' error

本文是小编为大家收集整理的关于linq联合类型推理调用失败 'join'错误的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我有 3 个表 User、TeamMember 和 Assessment,这三个表都有 user_id 列,User 通过 userid 链接到 TeamMember,TeamMember 和 Assessment 链接到 user_id(TeamMember) &评分者,评分(评估)

我正在尝试加入这个

          from a in db.Assessments
                         join u in db.Team_Members on a.rated equals u.user_id
                         join u2 in db.Team_Members on a.rater equals u2.user_id

抛出这个错误

<块引用>

join 子句中的一个表达式的类型不正确.调用"加入"时类型推断失败.

知道发生了什么吗?

推荐答案

你需要确保a.rated/u.user_id和a.rater/u2.user_id是同一类型

本文地址:https://www.itbaoku.cn/post/1556916.html

问题描述

i have 3 tables User, TeamMember and Assessment all three have the user_id column, User is linked to TeamMember by userid and TeamMember and Assessment are linked with user_id(TeamMember) & rater,rated(Assessment)

Im trying to join in with this

          from a in db.Assessments
                         join u in db.Team_Members on a.rated equals u.user_id
                         join u2 in db.Team_Members on a.rater equals u2.user_id

It's throwing this error

The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'.

Any idea what going on?

推荐答案

You need to make sure a.rated / u.user_id and a.rater / u2.user_id are the same type