基本上我想做的是在外键上加入两个表。我有这个查询:
var result =
_session.QueryOver(() => contentReferenceAlias)
.Inner.JoinAlias(() => contentReferenceAlias.ContentReference, () => contentLibrarySearchAlias.ContentReference)
.Where(() => contentReferenceAlias.ToLanguage.Id == languageId && contentReferenceAlias.ContentReference.Id == contentLibrarySearchAlias.ContentReference.Id)
.SelectList(list => list
.Select(() => contentReferenceAlias.ContentReference)
.Select(() => contentLibrarySearchAlias.ContentReference)
.Select(() => contentReferenceAlias.ContentReference.Id).WithAlias(() => resultAlias.ContentReferenceId)
.Select(() => contentReferenceAlias.ContentReference.Id).WithAlias(() => resultAlias.ContentReferenceId)
.Select(() => contentReferenceAlias.OrderedFrom).WithAlia
试图重新创建的 SQL:
SELECT A.OrderedFrom, C.LastOrdered, A.ContentReferenceId, B.Title FROM TranslationContentReference A
INNER JOIN TranslationOrder C ON (A.TranslationOrderId = C.Id)
INNER JOIN ContentLibrarySearch B ON (A.ContentReferenceId = b.ContentReferenceId)
WHERE A.ToLanguageId = 'xxxx-xxxx-xxxx-xxxx-xxxx'