title: Generate .NET DataSet file from a query?
body: <p>I use a Postgres database for my backend for multiple web applications.  These applications are hosted on a third party server that I have limited access to.  I currently use npgsql and nhibernate for all my data connection needs, and this works quite well.</p>
  
  <p>Well, now I need to write some Crystal Reports.  For performance's sake (and because the results data will not fit into any entities) I can't use my nhibernate entities as a data source for the reports; likewise I can't create an ODBC connection for the Crystal Reports because there is no driver or DSN on the destination server.  So, I thought, maybe I can build datasets based off of queries I write, and fill them using the Npgsql data provider, and feed these to the Crystal Reports.  I have performed a proof of concept, and it works pretty well.</p>
  
  <p>The problem is, I have a lot of reports, and a lot of datasets to build, and it's very time consuming to manually build the schema in each of these.  The dataset automation interfaces won't let me choose my npgsql data provider in the connection selector, which is rather annoying.</p>
  
  <p>I was hoping there might be a fairly straightforward way of throwing together a little code to get a dataset schema via the npgsql data provider at runtime, and then serialize the schemas into files I could then import into my reporting project in design time.</p>
  
  <p>Can this practically be done?  Is there an easier way?  There's a bunch of reports and a lot of columns, and hand-coding the schema for them will be extremely time-consuming.</p>