views:

56

answers:

0

I'm working on an application that generates a ADO.Net DataSet, which I want to be able to export to various data source types. I'd like to keep my export code generic so that I could switch between exporting to an MS Access file, SQL Server, MS Excel or other data source types with out creating a lot of duplicate code.

DbProviderFactories can be used to generalized connecting to an existing data source of an unknown type, but a known schema. Yet I want to create a new data source from and exsisting DataSet where the full schema is not known until run time.

I've seen examples where other people have created empty template versions of the various types of data sources they want to connect to. They then update their DataSet into the empty template to populate it with data. But again the schema of my data set can vary at run time, so there's no way I can create the template file ahead of time.

Right now I have my program exporting from the DataSet to XML or XSD, and then manually linking/importing these files into whatever data source type I want to use. I'd rather this be a direct link.

So is there a way to generically create a data source based on an exsisting DataSet with ADO.net? What about Linq?