0

查找表中出现的所有不同人员,这些人员负责创建连接更多或更多人员和实体项目的负责实体?

如何在技术中转换 sql 查询?sql查询是

select distinct p.PersonID,p.FirstName,p.LastName
from Responsible tr inner join People p on p.PersonID=tr.People_PersonID; 

我的尝试是

        string query = @"SELECT value empl 
                        FROM TicketBaseEntities.Responsible AS tr 
                        INNER JOIN TicketBaseEntities.People AS empl 
                        on empl.PersonID =tr.Responsibles.People_PersonID where tr.Responsibles !=null";
        return Context.CreateQuery<Employee>(query).Distinct();

错误信息是:

“People_PersonID”不是“Transient.collection[TicketBaseModel.Person(Nullable=True,DefaultValue=)]”的成员。要提取集合元素的属性,请使用子查询来迭代集合。接近简单标识符,第 5 行,第 63 列。

4

1 回答 1

0
(from tr in Responsible
join from p in People on tr.People_PersonID equals p.PersonID
select p.PersonID,p.FirstName,p.LastName).Distinct()

您可以实现 IComparer 接口以使用 Class People 的 Distinct() 函数

于 2012-07-10T12:15:44.273 回答