What happens to the following code (in NHibernate 2.1.2)?
public IEnumerable<EmployeeSummary> List()
{
return Session.CreateCriteria<Employee>("e")
.SetCacheable(true)
.SetProjection(Projections.ProjectionList()
.Add(Projections.Property("e.Id"), "Id")
.Add(Projections.Property("e.CurrentOffice.Id"), "CurrentOfficeId")
.SetResultTransformer(new AliasToBeanResultTransformer(typeof(EmployeeSummary)))
.List<EmployeeSummary>();
}
public class EmployeeSummary
{
public Guid Id { get; private set; }
public Guid CurrentOfficeId { get; private set; }
}
I get the following error: NHibernate.Exceptions.GenericADOException: cannot search [SQL: SQL is unavailable] ----> System.InvalidCastException: Cannot cast object of type "EmployeeSummary" to type "System.Object []".
source
share