Typed Datasets and .NET Remoting

Mads took the red pill and it's trying Typed Datasets, and has some doubts about how to use them with Remoting. I'll share our experience with DeKlarit.

a) The Typed DataSets generated by VS.NET 2002/2003 cannot be used with Remoting because the DataTables lack some serialization stuff. You can add it by yourself doing what this article suggests, or by using another DataSet generator. There is an ADO.NET PowerToys project in GotDotNet workspaces that includes one, but I'm not sure if it solves this issue, but it's quite easy to implement. DeKlarit also generates the needed stuff.

b) With DeKlarit you can generate two projects, one with the DataSets and another with some DeKlarit-specific DataAdapters which are the ones that fill and persist the DataSets. The project with the DataSets is shared between tiers.  You don't need to WriteXml/ReadXml as DataSets will serialize themselves as XML.

c) The DataAdapters are the remoted objects, and each one implements its own interface. They presentation layer code uses the interface to interact with them. Ingo explains this usage pattern here.

d) DataSets always serialize as XML even if you are using a binary formatter, and they always include the XML Schema when they serialize. I feel that there should be a way to improve this behavior, but I did not found the time to hack it.

About the database/xsd synchronization, in DeKlarit you really define a structure that generates the XSD _and_ the database schema, so you have that problem solved.

 

 

2 Comments

  • I use the same approach as you do; sharing the datasets between tiers. I also have implemented interfaces that I distribute with the datasets like ingo describes. I do not agree however to using the DataAdapters as the remoted objects. I create service objects that can, if needed, be extended to ServicedComponents.

  • Yes, I agree, we call them 'DataAdapters' because they just implement IDataAdapter, but they are a custom class that loads/persists the DataSet.





    You can add a ServicedComponent wrapper to it that implements the interface and calls the DataAdapter, and you can use it from the remoting client.

Comments have been disabled for this content.