Reputation: 1549
I have the following code which works fine. However, I only want to return rows where eventID = 5; Where can I add criteria to this query?
tx = session.BeginTransaction();
List<Catergory> Catergories;
using (tx)
{
Catergories = (List<Catergory>)session.CreateCriteria(typeof(Catergory)).AddOrder(Order.Asc("catergoryType")).List<Catergory>();
tx.Commit();
}
return Catergories;
Any help much appreciated.
Tried this but keep getting the following fault;
Catergories = (List<Catergory>)session.CreateCriteria(typeof(Catergory)).Add(Expression.Eq("calEventID",eventID)).AddOrder(Order.Asc("catergoryType")).List<Catergory>();
"Unable to cast object of type 'NHibernate.Impl.QueryImpl' to type 'System.Collections.Generic.List
1[Kanpeki.Domain.Catergory]'."
1[Kanpeki.Domain.Catergory]'.' faultDetail:'null'"
message = "faultCode:Server.Processing faultString:'Unable to cast object of type 'NHibernate.Impl.QueryImpl' to type 'System.Collections.Generic.Listenter
Upvotes: 0
Views: 848