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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:02:48+00:00 2026-05-26T20:02:48+00:00

I have a WCF service that passes back and forth the following DataContracts: [DataContract]

  • 0

I have a WCF service that passes back and forth the following DataContracts:

[DataContract]
public class RequestWrapper
{
    [DataMember]
    public FooDataContract FooDataContract;
}

[DataContract]
public class ResponseWrapper
{
    [DataMember]
    public FooDataContract FooDataContract;
}

[DataContract]
public class FooDataContract
{
    public FooDataContract(string data, Guid id)
    {
        Data = data;
        ID = id;
    }

    [DataMember]
    public string Data { get; set; }

    [DataMember]
    public Guid ID { get; set; }
}

It’s called via a proxy class like this:

void CallService(string data)
{
    var id = Guid.NewGuid();

    var response = proxy.CallService(new RequestWrapper
    {
        new FooDataContract(data, id);
    });
}

This is then passed (over the service) to the database via a repository using EF:

public void RepoMethod(FooDataContract foo)
{
    var guid = foo.ID; // - Breakpoint here shows all zeros!

    efContext.DoSomething(foo.Data, foo.ID);
}

Here’s the service call:

public ResponseWrapper CallService(RequestWrapper request)
{
    var foo = request.FooDataContract;
    repository.RepoMethod(foo);

    var response = new ResponseWrapper{ FooDataContract = foo };
    return response;
}

Here’s the proxy:

public class Proxy : IMyService
{
    static readonly ChannelFactory<IMyService> channelFactory =
        new ChannelFactory<IMyService>("IMyService");

    ResponseWrapper CallService(RequestWrapper request)
    {
        return channelFactory.UseService(s => s.CallService(request));
    }
}

internal static class UseServiceFunction
{
    internal static R UseService<T, R>
            (this ChannelFactory<T> channelFactory, Func<T, R> useService)
    {
        var service = channelFactory.CreateChannel();
        try
        {
            R response = useService(service);
            return response;
        }
        finally
        {
            var channel = service as ICommunicationObject;
            try
            {
                if (channel.State != CommunicationState.Faulted) channel.Close();
            }
            catch { channel.Abort(); }
        }
    }
}

I’ve put a watch on the Guid in the VS debugger. When the service is called from a client web application, the generated Guid is a valid Guid of seemingly random hex characters. Great, that’s working.

But when the data is serialized, goes over the wire, and comes out the other side (in my repository), the Guid is all zeros!

I’ve double, triple checked that the Guid is indeed marked with the [DataMember] attribute. I’m wondering if the extra layer of DataContract (how a FooDataContract is wrapped with the RequestWrapper data contract) is causing a serialization issue?

  • 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-26T20:02:48+00:00Added an answer on May 26, 2026 at 8:02 pm

    Turns out, my translation layer wasn’t updated to convert between the DTOs! Whooooops!

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

Sidebar

Related Questions

I have a wcf service in front of an AzMan store that passes roles
I have a WCF service layer in my application that passes DTOs to UI.
I have a WCF service that calls the following method in one of my
I have a WCF service that works ok if I create the service without
I have a WCF service that posts messages to a private, non-transactional MSMQ queue.
I have a WCF service that is returning a block of xml. One element
I have a WCF service that is performing some updates across a couple of
I have a wcf service that uses the .net System.AddIns framework to load assemblies
I have a WCF service that needs to notify it's clients when changes occur
I have an wcf service that is hosted in II6. The service uses the

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.