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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:56:59+00:00 2026-06-16T03:56:59+00:00

I have a project that communicates with a WCF service to access data. Sometimes

  • 0

I have a project that communicates with a WCF service to access data. Sometimes the server is local and then it uses sql stored procedures to query the database directly.

To explain, suppose I have the following method:

Asset GetAsset(int AssetID);

This method is either exposed by the WCF service or used locally when querying the database directly. The problem I have is that the Asset object for the exposed method of the WCF service is different to the local method. ie
Exposed service method is:

WcfService.Asset GetAsset(int AssetID);

Direct DB query method is:

LocalNamespace.Asset GetAsset(int AssetID);

While I can, I don’t want to make the Direct DB query method use the WcfService Asset object since I want to be able to remove the WcfService if need be. Ideally I want to bundle the common objects/interfaces in a separate assembly that I can use both locally and on the service.

Do I have any a choice though? Maybe I don’t know enough about the Referenced Assemblies option, although it is on.

  • 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-16T03:57:00+00:00Added an answer on June 16, 2026 at 3:57 am

    You can definitely do that, it’s one of the great strengths of WCF. Create a separate assembly containing your [DataContract] classes, [ServiceContract] interfaces, and nothing else. You can then use it however you like, in a WCF service, WCF client, or outside WCF altogether. Use the Referenced Assemblies option when adding a service reference to ensure that your contract assembly gets used.

    You can go one better than that. Move your service contract implementation classes into another separate assembly. You can then call them directly in-process without going via a service call. This reduces your WCF service project to a collection of .svc files and a web.config.

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

Sidebar

Related Questions

I have a silverlight application that uses wcf service. This application is shown from
I'm working on a bigger project which uses WCF data service and OData to
I have a project that uses TCP sockets to communicate between a server and
We have an n-tiers architecture : -a WCF Service that communicates with the database
I have a project that may be started on local machine with ./manage.py runserver
I have a project that I've added to my Jenkins server. The project includes
I have a project that uses two third party libraries, both of which make
I have been working on a Silverlight app that consumes a WCF service. [on
I have a .NET 4.0 project with two modules that will communicate via WCF
I have a project in native c++ that currently communicates with a c# project

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.