could not resolve property (complex properties)

Posted by felipeoriani on Stack Overflow See other posts from Stack Overflow or by felipeoriani
Published on 2012-07-08T20:40:52Z Indexed on 2012/07/08 21:15 UTC
Read the original article Hit count: 136

Filed under:
|
|
|
|

I have a asp.net mvc application with NHibernate and I do not know how to resolve a problem to query some data. I have this query:

// create query
var query = session.QueryOVer<Laudo>().Fetch(x => x.Equipament).Eager;

// add some filters
if (idEquipament.HasValue) 
  query = query.And(x => x.Equipament.Id == idEquipament.Value);

//I got the error here...
if (idCompany.HasValue)
  query = query.And(x => x.Equipament.Company.Id == idCompany.Value);

When I try to execute this query, I've got an exception with this message: "could not resolve property: Equipament.Company.Id of: DomainModel.Laudo"

what can I do to fix this problem? Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET