Thanks to Rocky's feedback I reworked my initial solution to make it a little better.
This one doesn't involve reflection at all and it implements a custom interface that is used only between the proxy and the server component.
Also, I see I created some confusion with an ill choice of namespace naming. I changed them to be more Csla like. The assembly name also changed. Sorry if you had trouble with that.
Also, I separated the "dynamic proxy" part from the actual proxy that does compression so if you don't really need it, you can skip it. The new proxy is called "CompressedRemotingProxy" and the server component "CompressedRemotingPortal".
Here's a sample for the relevant web.config section:
<system.runtime.remoting>
<application>
<service>
<wellknown mode="SingleCall" objectUri="RemotingPortal.rem" type="Csla.Server.Hosts.RemotingPortal, Csla"/>
<wellknown mode="SingleCall" objectUri="RemotingPortalCompressed.rem" type="Csla.Server.CompressedRemotingPortal, Csla.Compression"/>
</service>
<channels>
<channel ref="http">
<serverProviders>
<provider ref="wsdl"/>
<formatter ref="soap" typeFilterLevel="Full"/>
<formatter ref="binary" typeFilterLevel="Full"/>
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
And here's the same for the client's app.config:
<add key="CslaDataPortalProxy" value="Csla.DataPortalClient.CompressedRemotingProxy, Csla.Compression"/>
<add key="CslaAuthentication" value="Csla"/>
<add key="CompressedDataPortalUrl" value="http://localhost/CompressedPortal/RemotingPortalCompressed.rem"/>
<!--<add key="CslaDataPortalUrl" value="http://localhost/CompressedPortal/RemotingPortalCompressed.rem"/>-->
I created a new parameter for passing the url: CompressedDataPortalUrl. If the parameter is not found, it falls back to CslaDataPortalUrl (notice it's commented out in the snippet).
Make sure you test the server component from the browser in case you have something wrong in your config. Paste this as the url in your browser:
http://localhost/CompressedPortal/RemotingPortalCompressed.rem?wsdl
If you get an xml result then you're good to go.
For those of you who are interested in using the dynamic changing of dataportal types, use "CustomDataPortalRemotingProxy" instead of CompressedRemotingProxy in your app.config.
You can get the source code
here.
Well, that's it. Enjoy!
Andrés