LINQ to Nhibernate重复连接

Sly*_*Sly 15 .net c# linq nhibernate linq-to-nhibernate

我有这样的查询

var orderedQueryable = this.participationRequests
           .Fetch(x => x.CommunityEvent)
           .Fetch(x => x.CommunityMember)
                .ThenFetch(x => x.User)
           .Where(x => x.CommunityMember.Community.Id == communityId)
           .OrderBy(x => x.CreateDate);
Run Code Online (Sandbox Code Playgroud)

由于此错误,where子句需要在获取之后.问题是thouse Fetch调用发出额外的连接.在SQL查询中,如下所示:

select *
from   ParticipationRequests participat0_
       left outer join CommunityEvents communitye1_
         on participat0_.CommunityEventId = communitye1_.Id
       left outer join CommunityMembers communitym2_
         on participat0_.CommunityMemberId = communitym2_.Id
       left outer join Users user3_
         on communitym2_.UserId = user3_.Id
       inner join CommunityMembers communitym4_
         on participat0_.CommunityMemberId = communitym4_.Id
       inner join CommunityMembers communitym5_
         on participat0_.CommunityMemberId = communitym5_.Id
       inner join Communities community6_
         on communitym5_.CommunityId = community6_.Id
where  community6_.Id = 2002 /* @p0 */
order  by participat0_.CreateDate asc
Run Code Online (Sandbox Code Playgroud)

它做内部连接放置条件CommunityId并做左外连接做提取.

我发现了类似的问题,但我的查询有不同的执行计划,有或没有额外的连接.

它是LINQ提供程序中的错误吗?也许有一个解决方法?

Sly*_*Sly 4

添加了nhibernate jira 上的问题