Hi all,
I'm using NHibernate with Fluent, and I'm trying to do a GetAll type thing using Critera.List
:
public static List<T> GetAll(int pageIndex, int pageSize)
{
using (ISession session = Utils.OpenSession())
{
using (ITransaction transaction = session.BeginTransaction())
{
ICriteria criteria = session.CreateCriteria(typeof(T));
criteria.SetFirstResult(pageIndex * pageSize);
if (pageSize > 0)
{
criteria.SetMaxResults(pageSize);
}
return criteria.List<T>() as List<T>;
}
}
}
My map looks like this:
public class GenreMap: ClassMap<Genre>
{
public GenreMap()
{
Table("Genres");
Id(x => x.ID);
//.GeneratedBy.Identity();
Map(x => x.Name, "GenreName")
.Length(1000);
}
}
The underlying PK/ID is GenreID
(not ID), but I've set the map up correctly (or so I believe).
So why am I getting that error?