Can you use DataSet and DataTables in a Portable C

2019-07-07 16:46发布

问题:

I am working on a project that relies on DataSet and DataTable. We wish to move into cross platform so are looking at Portable Class Libraries. However we cant find out how to use DataSet and DataTable in a portable class library. Are they available?

Maybe we should be moving away from DataSets and DataTables but we have what we have right now.

回答1:

No the Dataset and DataTable are quite Windows specific Data structures, they would not be cross compatible, you may instead plan to serialize your result in to XML, Json, which would be available for use in all the platforms, thus achieving the inter-operability as expected, this would surely mean than in Windows you need a wrapper to de-serialize the XML / Json into relevant in memory object like DataTable



回答2:

In the Shim library that I have developed, there is basic and incomplete support for DataSets and DataTables.

Shim is a Portable Class Library which offers basic implementations of some types and methods that are available in .NET Framework but not in PCL. I developed Shim primarily to facilitate the porting of the Accord.NET Framework to various platforms via PCL. Accord.NET relies to some extent on ADO.NET and I therefore implemented the ADO.NET classes and methods Accord.NET required in Shim.

You might want to take a look at Shim here to see if it fits your needs. It is also available as NuGet packages.