对于报告方案,特别是对于大型记录(+百万条记录),我决定绕过nhibernate对象映射!并直接映射到DataSet!
这是算法
ICriteria criteria = _session.CreateCriteria(entityType);
// Add some filters and paging to criteria
ISQLQuery sql = GetGeneratedSql(criteria); // According to (http://stackoverflow.com/questions/10704462/how-can-i-have-nhibernate-only-generate-the-sql-without-executing-it/10710451#10710451)
IList<object[]> data = sql.List<object[]>();
我没有弄清楚如何找到nhibernate用于构建SQL的列