2

Is there a way to create WCF proxy objects on the fly without using codedom? By on the fly I mean during runtime. So lets say I have a smart client application that is accessing a WCF service. The Data Contract for the WCF service is changed while the client is running. I want to dynamically create a new proxy object that reflects the changed data contract.

3 Answers 3

4

You should read this article: WCF the Manual Way… the Right Way

And look into using the ChannelFactory class. You are going to have alot of reflection to create and invoke the members if the contract changes on the fly but I can't think of any reason you shouldn't be able to do it.

Sign up to request clarification or add additional context in comments.

Comments

0

I came up with a solution, using a shared assembly for contracts and endpoint interfaces.

So The Projects Would Be

  1. Host
  2. Contacts & Endpoints
  3. Client With Proxy

    public class YourProxy : ClientBase {}

Comments

0

Be careful about doing too much stuff on the fly. Even using reflection it might become too easy to couple your Client/Proxy/Service/Contract together too much.

Creating manual proxies and adding them as a reference to your client is a fantastic idea.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.