0

I need to add functionality to my web service calls so object translation and automatic retries are done and abstracted away.

I would usually override the base class to add the extra functionality, but as the proxy methods aren't over-ridable I can't keep the method names the same. The only other option I can think of to do it this way is to use the 'Shadows' keyword to achieve what I want. Now I don't like the idea of shadows as it isn't particularly OOP, but in this case it seems to make a neat solution.

What other methods do people use to add functionality to their web service proxy classes without modifying the generated classes?

4

1 回答 1

1

您可以使用组合优于继承的原则来实现这一点。例如,围绕您的 Web 服务编写一个包装器以获得所需的功能。

更新:代码示例

interface IWebService
{
    void DoStuff();
}

public class MyProxyClass
{
    IWebService service;

    public void DoStuff()
    {
        //do more stuff
        service.DoStuff();
    }
}
于 2011-07-28T14:33:45.427 回答