Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8871493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:00:22+00:00 2026-06-14T18:00:22+00:00

Good evening everyone. I’m developing a application with MVVM, Fluent NHibernate, WPF on C#.Net,

  • 0

Good evening everyone.

I’m developing a application with MVVM, Fluent NHibernate, WPF on C#.Net, and we need to generate reports of some windows. I need to create a Report using a Crystal Reports tool. AFAIK, Crystal Reports only generate reports with DataSets. In siimple application, i could only generate a DataSet, build the report, and make it run. But how i could do to make NHibernate understant, or how to make it works, passing data with NHibernate, instead of creating a DataSet and make this Report to directly access the database? In a short way to ask: I want to use all data obtained with NHibernate to populate the Report.

Any help will be welcome!!!

Best Regards,

Gustavo

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:00:23+00:00Added an answer on June 14, 2026 at 6:00 pm

    http://ayende.com/blog/2376/converting-an-object-collection-to-a-dataset

    http://abombss.com/blog/2007/05/09/nhibernate-to-dataset/

    Yours is not a new problem. Basically, the usual solution is to get the information from NHibernate as a collection of domain objects, and then manually build a DataTable using the properties of those objects.

    You can also bolt a little vanilla ADO onto NHibernate. NHibernate ITransactions have an Enlist() method which basically allows you to associate a plain ol ADO DbCommand to the ADO DbTransaction way down in the bowels of NHibernate’s implementation, and execute it as you would if you weren’t using NHibernate, to get results in ADO.NET format. Here’s something I put into a Repository implementation, allowing me to call legacy stored procedures by name:

        public IDataReader ExecuteReaderStoredProcedure(string procName, IUnitOfWork uow, IEnumerable<KeyValuePair<string, object>> parameters)
        {
            var command = Sessions[uow].Connection.CreateCommand();
    
            command.CommandText = procName;
            command.CommandType = CommandType.StoredProcedure;
            foreach (var param in parameters)
            {
                var parameter = command.CreateParameter();
                parameter.ParameterName = param.Key;
                parameter.Value = param.Value;
                command.Parameters.Add(parameter);
            }
    
            Sessions[uow].Transaction.Enlist(command);
            return command.ExecuteReader();
        }
    

    The DataReader can then be used to populate a DataTable/DataSet.

    Some notes; the IUnitOfWork object you see is a token that links to a Session and its Transaction, and is used to control their scope and lifetime; you can modify this to use whatever session-handling mechanism you have (including creating a new Session from the SessionFactory just for this command, if you choose). You can also pass in “naked” SQL strings to execute; I typically avoid this (in fact, the names of the stored procs in the actual implementation are abstracted behind constant instances of a particular static type, similar to an enum).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good evening! I'm developing a web application with asp.net C#. In this application the
Good evening everyone! I am having a bit of a problem and need some
Good evening, I am working on a program where some application config info is
Good evening. I am using Yii framework and mPDF library to generate some PDF
Good evening, I am currently developing an application for android using phonegap and sencha
Good evening. I'm developing an android application that uses Facebook SDK. I've no problem
Good evening everyone, before explaining my problem, I should give you some explanation on
Good evening everyone! I am working on learning some java and I have made
Good evening,someone asked me to help her with fixing some code for asp.net, she
Good evening everyone, I was hoping you could help with an Objective-C question I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.