Tôi có một câu hỏi như thế nàyLINQ to bản sao Nhibernate tham gia
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);
Các mệnh đề where cần phải sau lấy do this bug. Vấn đề là thây Fetch
cuộc gọi đưa ra các kết nối bổ sung. Trong truy vấn SQL trông giống như sau:
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
Nó tham gia bên trong để đặt điều kiện trên CommunityId
và không tham gia bên ngoài để tìm nạp.
Tôi đã tìm thấy similar question, nhưng truy vấn của tôi có kế hoạch thực hiện khác nhau có và không có sự tham gia bổ sung.
Đây có phải là lỗi trong nhà cung cấp LINQ không? Có thể có một cách giải quyết?