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 386829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:36:50+00:00 2026-05-12T15:36:50+00:00

I am confused how to add/include/reference a set of supporting classes required for both

  • 0

I am confused how to add/include/reference a set of supporting classes required for both server and client projects where WCF is involved.

In my C# solution I have:

  • A Server project doing server type stuff
  • A Client project doing gui type stuff
  • A WCF Library containing class definitions for network passed data objects

The Server project uses a normal reference to include the WCF library. The Client project uses a service reference to the WCF library.

My problem is that I have a couple of utility classes that are needed in both the Server and Client projects which use object definitions contained in the WCF library. I don’t want to have two (identical) copies of these classes placed in the Server and Client projects – I would prefer just maintain the one copy. That would suggest using a class library, but how does the referencing work then? This new class library would have a standard reference to the WCF Library, and then both the Server and Client projects would have to standard reference this new class library in turn. But wouldn’t then the Client project now have two differently defined definitions of the data objects classes contained in the WCF library? How else should these utility classes be included?

  • 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-05-12T15:36:51+00:00Added an answer on May 12, 2026 at 3:36 pm

    Using the service reference approach takes some of the initial sting out of using WCF because it generates code for you that simplifies your life in those early WCF days. However, as you grow more accustomed to using WCF and you realize what the service reference is actually doing, you begin to realize that the service reference approach is sometimes more of a hindrance than a help.

    For example, in my case, I had a WCF service that was used by three different projects – two C# projects and one managed C++ project. Everytime I updated the WCF service interface, I had to go re-generate the service reference in each of these three projects. It quickly became a headache for me.

    In addition (and you’re running into this), the service reference approach only deals with the structure of your DataContract classes, not their behavior. So if you add convenience methods to the DataContract classes on the server side, that behavior must be manually added on the client side because it is not conveyed via the metadata exchange (MEX) operation.

    That’s when I stumbled across this video. In it, Miguel Castro presents a convincing case to avoid using the service reference approach altogether. And when you examine his argument, it really makes a lot of sense.

    Based on his recommendations, I would suggest putting your DataContract classes and the classes that operate on them in a class library that is referenced directly (no service reference) by both the Client and Server. As you will see from the video, it is pretty straightforward to write the client-side code yourself and just update it when your WCF interface changes.

    I have used this approach now for a couple of months, and I have found the solution to be much more flexible to the way I use WCF than using the service reference approach.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a bit confused at how to add a message to an error logged
i am confused about how i can add a link to the following code
I'm recently getting a bit confused with interfaces and abstract classes and I feel
I want to add interactivity like clicks, hover, onpage load() to a webpage, if
Hi i am not able to add uiactivity indicator in uitableview controller, can someone
i'm pretty confused over the following issue and would be grateful for some clarity.
I would like to add an invite_code requirement for users to sign up. Ie.
I'm just getting started DNN skinning and am confused by how skin.css works. I'm
I'm a little bit confused concerning variable updates in XQuery: On [1] it says:
HI all, I'm having some difficulty understanding the rationale behind group by aggregation in

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.