Custom data portal channel samples

Custom data portal channel samples

Old forum URL:

RockfordLhotka posted on Wednesday, August 26, 2009

There are now a couple custom data portal channel examples in the Samples folder in svn.

The AppDomainProxy sample has been there for a long time, and shows now to create a channel that runs the data portal code in a separate AppDomain and on a separate thread, without actually going over the wire. I created this for the unit tests, because it simulates a remote data portal without all the overhead of setting up an actual app server.

I just added the WcfBfProxyHost sample. This new sample shows how to use the BinaryFormatter to serialize the object graph, and then send the resulting byte array over WCF to the server. It is very similar to the way the WebServicesProxy works.

The reason I wrote this new sample is that WCF uses the NetDataContractSerializer to serialize the object graph. NDCS is very nice, because it provides the same semantic behavior as BinaryFormatter, but is part of WCF. However, the XML it creates is pretty darn big, and I was experimenting with ways to reduce the size of the messages on the wire.

The BinaryFormatter, in general, produces smaller data streams than NDCS by around 20%, so that's good. But even with a 20% reduction the data stream is pretty big.

The best answer, I think, is to use a WCF binding that does compression. While the NDCS XML is huge, it is XML and so it compresses very effectively.

Copyright (c) Marimer LLC