문제

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