Mam zapytanie jak tenLINQ do duplikatów NHibernate dołącza
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);
klauzula WHERE musi być po sprowadzić powodu this bug. Problem polega na tym, że te wywołania Fetch
powodują dodatkowe sprzężenia. W SQL kwerendy wygląda następująco:
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
Czyni wewnętrzna przyłączyć postawić warunek na CommunityId
i nie opuścił sprzężenia zewnętrznego robić pobierania.
Znalazłem similar question, ale moje zapytanie ma inny plan wykonania zi bez dodatkowych połączeń.
Czy to błąd w dostawcy LINQ? Może istnieje obejście?