For reporting scenarios, specially for large records (+millions records) I decided to bypass the nhibernate object mapping! and directly map to DataSet!

Here is the algorithm

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[]>();

I didn't figure out how to find the columns that nhibernate used to build the SQL

有帮助吗?

解决方案

If you need a DataSet can use this transformer: here

Its transform to a DataTable but is easy to handle it.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top