We have an an existing Business Layer that talks to an oracle DB Layer. All the procedures returns a DataTable. Since Silverlight does not support DataTables, I am not sure what is the easiest way of exposing the business Layer.
I would rather not re-write the business layer. Is there some way to convert the datatable to something usable in SilverLight. That way I can just expose whatever methods in my business layer I need for the SilverLight app in a WCF Service
Thanks,
John
DataTables aren’t a great fit for a data transfer object format, for precisely the reason that you mention, and they’re being phased out in favor of things like the Entity Framework. The ADO.NET team posted a blog that discussed this precise problem here.
As other folks have mentioned, if you don’t want to change your business layer, one option is to write an intermediate layer that converts the DataTable either to a reasonable XML or JSON format, or to a series of classes that can then be serialized into either XML or JSON.
But another that you should investigate is the SilverlightDataSet project hosted here, which supposedly gives Silverlight the ability to consume DataSet objects that have been serialized to XML. Haven’t tested it myself, but it sounds like it’s worth investigating.