Nhibernate could not resolve property exception when using QueryOver, works on QueryAll

前端 未结 1 1023
自闭症患者
自闭症患者 2020-12-30 13:27

I have the following problem
Basically I have the 2 snippets below:

var contactAssociation =
    session.QueryOver(() => c         


        
1条回答
  •  北海茫月
    2020-12-30 14:19

    You need to specify a Join in the first query. The LINQ provider in the second query does it automatically for you.

    session.QueryOver(() => contactAssociationAlias)
       .Where(() =>
           contactAssociationAlias.Contact.ID == careGiverId &&
           contactAssociationAlias.Client.ID == clientKey)
       .JoinQueryOver(() => contactAssociationAlias.AclRole)
           .Where(a => a.RoleName == "Care Giver")
       .SingleOrDefault();
    

    0 讨论(0)
提交回复
热议问题