views:

17

answers:

1

I have a silverlight application that is like a portal where user-defined widgets will be calling wcf services. Since these components could be quite chatty I would like to hijack the service calls and have them flow through a single client proxy that could throttle, potentially cache results, etc.

So the idea would be to have the dispatch in the client proxy simply call another client proxy (the master) rather than going over the wire. At least I think that's what I want. The master would return an asyncresult and service the request at its discretion or perhaps return some cached data.

Do the appropriate wcf extension points for something like this exist in silverlight? Is it even possible to accomplish this without using runtime code generation/compilation? I'm a WCF n00b so any help would be greatly appreciated.

A: 

I do not think that it is possible to hijack the service calls as you describe. You may get thread problems as you wait collecting the calls.

What may work, is if you had a process that asked each widgit if it had any calls it wanted to make, collected all relevant information, made a single call to the server, then updated the widgits with the results.

I suspect that this opimisation is more work than it is worth. WCF calls from Silverlight are async.

http://stackoverflow.com/questions/1286864/silverlight-wcf-proxy-async-only

Shiraz Bhaiji
What if i was willing to have a compile-time component to this solution? In our thick client application we achieve something like what I'm describing using codedom at runtime. That's not really an option for silverlight but perhaps there is a coding idiom I could use? Certainly I could modify all known service proxies to use it at least. Just brainstorming.
mattx