Hello,
I am currently trying to query a table which has a many-to-one relationship with another table. consider the following sales - orders example. I am trying to get all orders associated with a particular saleID. I have tried using the following -
Code:
public IList<order> getOrderBySalesId(int salesId)
{
return _session.CreateCriteria(typeof(sales))
.Add(Expression.Eq("salesId", salesId))
.SetFetchMode("order", FetchMode.Eager)
.List();
}
However, I am getting the following error -
"The value \"sales\" is not of type \"order\" and cannot be used in this generic collection
Can anybody tell me what I might be doing wrong?
Thanks for any thoughts.