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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:39:36+00:00 2026-06-11T06:39:36+00:00

Is there any switch that instructs svcutil to generate DataContract properties with their names

  • 0

Is there any switch that instructs svcutil to generate DataContract properties with their names as defined in code? For example when I create a proxy which uses the following DataContract:

[DataContract(Namespace = "http://schemas.mynamespace.com/2012/08")]
public class MyDataContract
{
    [DataMember(IsRequired = true, Order = 0)]
    private int _id;

    public int Id
    {
        get { return _id; }
        set { _id = value; }
    }
}

I get this DataContract on the proxy generated class:

public partial class MyDataContract : object
{                
    private int _idField;

    [System.Runtime.Serialization.DataMemberAttribute(IsRequired=true)]
    public int _id
    {
        get
        {
            return this._idField;
        }
        set
        {
            this._idField = value;
        }
    }
}

The order property of the DataMemberAttribute is always ommited as well for the first 3 properties and a MessageContract ommits an IDisposable implementation.

  • 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-11T06:39:39+00:00Added an answer on June 11, 2026 at 6:39 am

    Well, I cannot comment on the omitted order, but I may be able to help on the rest:

    • One usually specifies the DataMember attribute on the property, not on the field. The data-contract itself does not distinguish between a property and a field, but it knows the name, type, if it is mandatory, etc. etc.

    • Added: What Chris said: With [DataMember(Name="whateveryouwant")] you’ll be able to set a name different from the field/property name. I do not like such usage, though, but it is helpful when refactoring code, but still keeping the API compatible.

    • Only other DataContract (and some intrinsically supported) types are serialized to/from messages. IDisposable seems not to be one.

    • Serializing the inherited IDisposable of a MessageContract would not make any sense. A message-contract is the .NET representation of a SOAP message. It literally has nothing else to do but to provide a 1:1 mapping between what is in the SOAP message XML, and the accessible .NET types.

      A message is part of a ServiceContract, in that it specifies which kind of message must be sent to a certain operation to be a valid invocation, and another (response-)message contract specifies how the data, that the operation returns, will be structured. Nothing else; it is a data-aggregate.

    If you want to capture the result of a service-operation on the client, and for convenience automatically send a message back upon going out of scope (or for instance unregistering from a service), you will have to implement this on the client-side. Be aware, however, that the service must not require this to happen (due to lost connections, crashes, etc.).

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

Sidebar

Related Questions

Is their any cases in C++ Like these case WM_COMMAND: switch(LOWORD(wParam)) That happen when
Is there any .NET logging framework that have ability to switch appender if something
Is there any known/simple/open-source library that provide a javascript function that will switch colored
Is there any test macro that can be used to see if the code
is there any way to switch the user (to root or so) while deploying
Is there any way I can set a formatter on models that will convert
Are there any event that is fired when cell is about to be selected?
Is there any reason to switch from the default scope (transient?) to something else,
Is there any way to switch off the 'Wrapped around' functionality of Delphi 2010's
Is there any way so that you can call a function with a variable?

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.