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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:45:29+00:00 2026-05-15T01:45:29+00:00

I have two classes (Person and Address) that i need to send via wcf,

  • 0

I have two classes (Person and Address) that i need to send via wcf, the classes look like this:

public class PersoanaFizica :IExtensibleDataObject
{
    [DataMember]
    private Guid _id;
    [DataMember(Name = "Id")]
    protected virtual Guid Id
    {
        get { return _id; }
        set { _id = value; }
    }

    private ExtensionDataObject _extensionData;
    public virtual ExtensionDataObject ExtensionData
    {
        get
        {
            return _extensionData;
        }
        set
        {
            _extensionData = value;
        }
    }


    private string _firstName;
    [Searchable(PropertyName="FirstName")]
    [DataMember]
    public virtual string FirstName 
    {
        get { return this._firstName; }
        set { this._firstName = value; }
    }

    private string _lastName;
    [Searchable(PropertyName="LastName")]
    [DataMember]
    public virtual string LastName 
    {
        get { return this._lastName; }
        set { this. _lastName = value; }
    }

    private Address _address;
    [Searchable(PropertyName="Address")]
    [DataMember]
    public virtual Address Address 
    {
        get { return this._address; }
        set { this._address = value; }
    }
}

public class Address : IExtensibleDataObject
{
 [DataMember]
    private Guid _id;
    [DataMember]
    public virtual Guid Id
    {
        get { return _id; }
        set { _id = value; }
    }

    private ExtensionDataObject _extensionData;
    public virtual ExtensionDataObject ExtensionData
    {
        get
        {
            return _extensionData;
        }
        set
        {
            _extensionData = value;
        }
    }

        private string _country;
    [Searchable(PropertyName="Country")]
    [DataMember]
    public virtual string Country 
    {
        get { return this._country; }
        set { this._country = value; }
    }
// and some other properties related to the address
}

The problem is that when i try to send them via wcf, the client receives the Id properties set to 00000-0000-00000-00000 or something like this.

Any idea why this is happening? And how to serialize the proper values?

  • 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-15T01:45:30+00:00Added an answer on May 15, 2026 at 1:45 am

    nope… did not help. I just looked at
    the code generated by svcutil.exe
    (thats what i use to generate my
    client) and i couldn’t find an Id
    property at all. I tried changing the
    protected keyword to public and
    everything worked fine. It seems that
    the problem is with the fact that i
    need the properties to be protected
    and not public.

    Denis – any chance at all that your WCF client uses the XmlSerializer (which only serializes public read/write properties with a get and set method) instead of the DataContractSerializer?? The DataContractSerializer would definitely serialize a protected property or field – it really doesn’t care about the .NET visibility modifiers….

    You should see this in the WCF client side proxy being generated – do you have [DataContract] and [DataMember] attributes there, or do you see [XmlElement] and so forth?? Does your class in the WCF client side proxy have a [DataContractAttribute] or a [XmlTypeAttribute] on it??

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

Sidebar

Related Questions

I have these two classes public class Person { } public class Company {
I have this weird situation. I have these two classes: Public Class Entry End
I have two entity classes: Person and Position . public class Person { public
I have two classes: public class Person { public string FirstName { get {
I have two classes that I would like to specify as follows: class Club
Let's say I have the following two classes: public class Person { public string
I am really confused about object relationships! I have two classes Person and Address.
I have two classes that I would like to merge into a composite. These
Let's say you have two classes, Person and Address. Person has a reference to
i have the two classes Person and Attribut, in short: @Entity @Indexed @Table(name=persons) public

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.