Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not resolve property in QueryOver

I have a method by QueryOver in Nhibernate3.1

 var q = SessionInstance.QueryOver<Person>().
 Where(person=>person.PersonIdentity.FirstName.IsLike(firstName,MatchMode.Anywhere));

 return q.List<Person>();

Now i have a runtime error by this message:

Could not resolve property: PersonIdentity.FirstName of: MyNameSpace.Domain.Entities.Person

Why?

like image 433
Ehsan Avatar asked Sep 14 '11 12:09

Ehsan


1 Answers

my problem resolved by add JoinQueryOver in Query

var q = SessionInstance.QueryOver<Person>().JoinQueryOver(p => p.PersonIdentity).Where(k => k.FirstName.IsLike(firstName, MatchMode.Anywhere));

By help of this link :

like image 77
Ehsan Avatar answered Oct 17 '22 20:10

Ehsan