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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:08:00+00:00 2026-05-29T11:08:00+00:00

I am not sure if it is an issue or not. If I use

  • 0

I am not sure if it is an issue or not.

If I use List here, It works in both root/xml/metadata?op=Competitions and root/Competitions

[DataContract]
public class CompetitionsResponse : IHasResponseStatus
{
    [DataMember]

    public List<Competitions> Competitions { get; set; }

    //Auto inject and serialize web service exceptions
    [DataMember]
    public ResponseStatus ResponseStatus { get; set; }
}

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CompetitionsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/FSI.API.ServiceModel">
  <Competitions>
    <Competitions>
      <CompName>String</CompName>
      <CompType>String</CompType>
      <CompetitionID>0</CompetitionID>
    </Competitions>
  </Competitions>
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
  </ResponseStatus>
</CompetitionsResponse>

But if I use “IEnumerable”

[DataContract]
public class CompetitionsResponse : IHasResponseStatus
{
    [DataMember]
    public IEnumerable<Competitions> Competitions { get; set; }

    //Auto inject and serialize web service exceptions
    [DataMember]
    public ResponseStatus ResponseStatus { get; set; }
}

The Competitions collection disappeared from the meta page
root/xml/metadata?op=Competitions

HTTP/1.1 200 OK

Content-Type: application/xml
Content-Length: length

<CompetitionsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/FSI.API.ServiceModel">
  <Competitions i:nil="true" />
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
  </ResponseStatus>
</CompetitionsResponse>
  • 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-29T11:08:01+00:00Added an answer on May 29, 2026 at 11:08 am

    ServiceStack uses the .NET’s XML DataContractSerializer under the hood for its XML Serialization which is the behavior your seeing. It also works with POCOs i.e. the [DataContract] and [DataMember] attributes are optional.

    It’s also not recommended to use interfaces on DTO’s (IMO there’s no good reason to) which should be as typed and as self-describing as possible. Many serializes won’t know what the concrete type of the IEnumerable should be so has to do some hacks like output dynamic typeinfo metadata in the payload, or assume a default collection type.

    Note: If you want the XML to be prettier than you should define a namespace for your DTOs – the best way to do that is define an Assembly Attribute in your AssemblyInfo.cs file:

    [assembly: ContractNamespace("http://schemas.servicestack.net/types",  
        ClrNamespace = "FSI.API.ServiceModel")]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure if I have a threading issue here or not. On the
I need help with LINQ syntax or methodology, not sure which. Here's my issue:
Not sure if I have the correct subject line. Here is my issue. I
I'm having the craziest issue with Firefox. I'm not sure if this issue is
I'm not sure if this is a simulator issue, but I don't remeber having
I'm having an issue where I'm preaty not sure how to resolve this and
We are getting a weird issue on which we are not sure what exactly
I am facing one issue and I am not sure if what i would
I am getting an error message, and I not quite sure where the issue
I'm not quite sure how to approach this issue: I am creating a web

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.