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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:41:51+00:00 2026-06-16T00:41:51+00:00

I have a WebAPI controller that I’m using with model classes with attributed properties

  • 0

I have a WebAPI controller that I’m using with model classes with attributed properties to transform the C# naming to a more JavaScript like naming. e.g.

    [DataMember(Name = "posInfo")]
    public string PositionInformation { get; set; }

Everything works fine if I expose the values over the wire. Now I tried to call the controller on the server side to bootstrap some initial values at application startup. But if I call the controller locally the [DataMember] attributes are not “resolved”. Everything comes back with the C# named properties.

When does the [DataContract][DataMember] stuff kicks in and how to use it if I call my controller locally?

  • 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-16T00:41:51+00:00Added an answer on June 16, 2026 at 12:41 am

    DataMember will be used when your object is de/serialized. So, if you are sending your object over the wire using web-api, your client should be receiving the property as posInfo. If you are referencing your object locally via .net (for example, in a library or a project reference), then you will be referring to the property by its name PositionInformation.

    Depending on the type of serialization that you are performing, it is possible that this property is not being translated or that the DataMember attribute is not supported. FWIW, the built-in XML and JSON serializers for Web API support the DataMember and DataContract attributes.

    More information on how the DataMember attribute works can be found at the MSDN site.

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

Sidebar

Related Questions

I have a WebAPI controller that need to download some files depending of the
I have a a view model that looks like. public class StoreItemViewModel { public
I have an ASP.NET WebApi application that has some controller methods that expect certain
Using ASP.Net WebAPI, I have a controller with an asynchronous action similar to the
I have a Web API controller that accepts an Inspection model, i.e. public class
Using the ASP.NET Web-Api, I have the following POST setup in my controller. When
I have a desktop webapi server that I want to expose to clients through
I have a Asp.net WebAPI service that is hosted on AppHarbor which throws 404
I have a layered web application that I built with ASP.NET MVC 4, WebAPI
I've created a method using the new WebAPI features in MVC4 and have it

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.