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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:35:03+00:00 2026-05-27T07:35:03+00:00

I have generated a set of classes based on a set of respective *.xsd

  • 0

I have generated a set of classes based on a set of respective *.xsd files using xsd.exe tool, as below:

xsd /c file1.xsd File2.xsd 

One of the generated classes is shown below:

[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]

[System.SerializableAttribute()]   //please note here

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]

//please note here
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.xx.com/xx")]

public partial class SelfEmploymentTypePartner
{

    private string nameField;

    private SelfEmploymentTypePartnerAddress addressField;

    /// <remarks/>
    public string Name
    {
        get { return this.nameField; }
        set { this.nameField = value; }
    }

    /// <remarks/>
    public SelfEmploymentTypePartnerAddress Address
    {
        get { return this.addressField; }
        set { this.addressField = value; }
    }
}

I want to use all generated classes for WCF, do I need to add DataContractAttribute, and DataMemeberAttribute to the class and its members? as below:

[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.1432")]

[System.SerializableAttribute()]    //please note here

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]

   //please note here
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, 
Namespace ="urn:corexx:Application")]

[DataContract(Name = "SelfEmploymentTypePartner")]  //please note here

public partial class SelfEmploymentTypePartner
{

    private string nameField;

    private SelfEmploymentTypePartnerAddress addressField;

    /// <remarks/>
    [DataMember]
    public string Name
    {
        get
        {
            return this.nameField;
        }
        set
        {
            this.nameField = value;
        }
    }

    /// <remarks/>
    [DataMember]
    public SelfEmploymentTypePartnerAddress Address
    {
        get
        {
            return this.addressField;
        }
        set
        {
            this.addressField = value;
        }
    }
}

Because the existing live version is using the version 1, If I change it to version 2, will that break the current users?

If I do need to, is there a easy way to do that. Because I have more than thousands of line of codes to edit.

The interface is below:

 [ServiceContract(SessionMode = SessionMode.Allowed, Namespace = "http://www.xxx.com" ,ProtectionLevel=ProtectionLevel.None)]
    [WsdlDocumentation("")]
    public interface IService
    {

        [OperationContract(ProtectionLevel= ProtectionLevel.None)]   //please note here
        [XmlSerializerFormat]   //please note here
        [FaultContract(typeof(ErrorDetailsStructure))]
        MyResponse GetInfo(RequestParameter parameter);

    }

When both OperationContract and XmlSerializerFormat are used for the interface, which one will be used.. Does WCF use XmlSerializer instead of DataContractSerializer?

  • 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-27T07:35:04+00:00Added an answer on May 27, 2026 at 7:35 am

    You don’t need to change the generated code. You only need to tell WCF you are using a different serializer in your service contract definition:

    [ServiceContract]
    [XmlSerializerFormat]
    public interface MyService
    {
        [OperationContract]
        [XmlSerializerFormat]
        void MyMethod();
    }
    

    However, you should read the pro’s and con’s of using DataContractSerializer vs XmlSerializer.

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

Sidebar

Related Questions

I have a set of classes build using xsd.exe, and I am trying to
I'm using ASP.NET MVC RC2. I have a set of classes that were auto-generated
i have generated a cs-classes with the xsd-tool from some xml scheme. The scheme
I have a web tool which when queried returns generated Java classes based upon
I have some set of xml generated via xmlserialization of some WCF messages. Now
I have a set of radio buttons that are dynamically generated (via JSON call):
I have a large set of data that is generated from a web service
I have a gridivew with auto-generated fields, whenever there is a new set of
I have generated a DAL layer with Subsonic2.2 for a .NET4.0 application, using c#
I have a multithreaded code that has to generated a set of objects and

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.