QueryOver с Join и Distinct

Я использую следующий QueryOver:

var query = searchTermRepository.GetAllOver()
     .Where(Restrictions.On<Entities.SearchTerm>(c => c.Text).IsLike(filter.Value, MatchMode.Start))
     .Select(Projections.Distinct(Projections.Property<Entities.SearchTerm>(x => x.Contact)))
     .Inner.JoinQueryOver(x => x.Contact).Take(100);

Это создает:

SELECT distinct TOP ( 100 /* @p0 */ ) this_.ContactId as y0_
FROM   SearchTerm this_
       inner join Contact contact1_
         on this_.ContactId = contact1_.Id
       left outer join Company contact1_1_
         on contact1_.Id = contact1_1_.Id
       left outer join Person contact1_2_
         on contact1_.Id = contact1_2_.Id
       left outer join Branch contact1_3_
         on contact1_.Id = contact1_3_.Id
       left outer join ContactGroup contact1_4_
         on contact1_.Id = contact1_4_.Id
WHERE  this_.Text like 'koc%%' /* @p1 */

Но я хочу

SELECT distinct TOP ( 100 /* @p0 */ )  this_.ContactId as y0_, contact1_.*
FROM   SearchTerm this_
       inner join Contact contact1_
         on this_.ContactId = contact1_.Id
       left outer join Company contact1_1_
         on contact1_.Id = contact1_1_.Id
       left outer join Person contact1_2_
         on contact1_.Id = contact1_2_.Id
       left outer join Branch contact1_3_
         on contact1_.Id = contact1_3_.Id
       left outer join ContactGroup contact1_4_
         on contact1_.Id = contact1_4_.Id
WHERE  this_.Text like 'koc%%' /* @p1 */

Я хочу выбрать все свойства контакта.

С уважением, Томас

7
задан Fourth 25 May 2011 в 17:29
поделиться