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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:37:56+00:00 2026-05-26T14:37:56+00:00

I have a case in which there are 3 hosts: A, B, and C.

  • 0

I have a case in which there are 3 hosts: A, B, and C. Host C periodically sends a heartbeat message to host B, which then sends a similar heartbeat message to A that contains all the information in the packet sent by C plus some additional stuff. Obviously, to enable this, A exposes a service to B, and B exposes a service to C.

The serializable class being passed to both is called NodeInfo. Basically just a simple collection of data members, NodeInfo is referenced by the service definitions for both A’s and B’s services.

Here’s the kicker: the Data Contract received by B is of type B.ServiceForC.NodeInfo. But the type that B needs to relay to A is of type A.ServiceForB.NodeInfo. So what I’m finding I need to do is write a lot of repetative code in B to copy data from the inbound NodeInfo‘s to some newly created outbound NodeInfo‘s.

My question is, is there a clever way to handle this? Is there a way to cast a B.ServiceForC.NodeInfo object to a A.ServiceForB.NodeInfo object so I don’t have to recreate all the objects and copy their data? Since they’re not related in any hereditary sense it doesn’t seem possible, but I don’t know.

I’ve done a lot of hunting but can’t seem to find anything that helps. Any suggestions, even if it’s a definitive “you’re outta luck,” would be helpful. Thanks.

  • 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-26T14:37:57+00:00Added an answer on May 26, 2026 at 2:37 pm

    By default WCF generates a client side copy of your service interfaces wrapped a namespace which are used in your proxy code. But you’re not forced to do it like this. Put your service interfaces in a lib/dll – delete the WCF generated interfaces from your WCF generated proxy code and use the interfaces from your lib namespace there instead.
    That way everything can just use MyLibNamepace.NodeInfo interface that is defined in your lib/dll.
    If you don’t already have an exisitng base lib/dll for common code then you could alternatively just compile in your own interface definitions directly into each application.

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

Sidebar

Related Questions

I have a pretty simple case which I started solving using foreach(), but then
I have a Boost unit test case which causes the object under test to
I have a 200+ case statement in Classic ASP which is getting out of
I have a Lucene index which is currently case sensitive. I want to add
I have the following use case , lot of code which was tightly coupled
I have a case that keeps coming up where I'm using a ListView or
I have a case where the child view sends notification to its parent view.
Say that you're developing code which needs to compile and run on multiple hosts
We have a Windows Service which hosts a number of WCF services and, in
I have a Eclipse Dynamic Web Project which host a simple servlet and runs

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.