Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8782691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:37:56+00:00 2026-06-13T20:37:56+00:00

In VS 2010 I’m creating a service reference which code generates the WCF client

  • 0

In VS 2010 I’m creating a service reference which code generates the WCF client proxy class Refernce.cs. I need the methods in this class to have the Virtual modifier so they can be used in Mock.

Of course I can hand edit the generated code, but every time I update the reference the code is going to be regenerated and wipe out my changes.

Do I have more control of how the WCF client proxy class is generated? Is there any way to have the code generator always add the Virtual modifier? I would like this to be more automated so that when other developers need to update the reference, they don’t have to know or remember to hand edit the generated code and add the the virtual modifier.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:37:57+00:00Added an answer on June 13, 2026 at 8:37 pm

    An alternative is to create an interface. The proxy classes are generated as partial, which means you can create another partial file for that class, and specify that the class implements your interface, even though the actual implementation is in the generated class. You can then mock the interface, and regenerate your proxy to your hearts content.

    For instance, your generated class might be:

    public partial class SomeService
    {
        public string GetSomething()
        {
            return ... 
        }
    }
    

    You can create an interface for this:

    public interface ISomeService
    {
        string GetSomething();
    }
    

    And then add an empty partial file for the generated class:

    public partial class SomeService : ISomeService
    {
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

VS 2010 Beta Code Analysis is advising me to always dispose WCF Service Clients
Delphi 2010 introduced custom attributes which can be added to type declarations and methods.
Which version of VS 2010 has PreFast static code analyzer for native c++? I
Delphi 2010 Windows 7 - 64 bit. I have an app which is reasonably
In Visual Studio 2010, I am trying to connect to a web service I
VS 2010, win server 2003, .Net 3.5 solution, which were migurated from .Net 1.1
VS 2010 code analysis reports the following: Warning 4 CA2000 : Microsoft.Reliability : In
While installing Visual Studio 2010 Service Pack 1, I am getting this error: Installation
Using Delphi 2010. I am looking for (possibly) a function or procedure which can
I'm using Excel 2010. I'm trying so save my excel file, with this code.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.