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

  • Home
  • SEARCH
  • 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 8941805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:23:14+00:00 2026-06-15T11:23:14+00:00

I have a wcf data service and a normal rest wcf service. Both services

  • 0

I have a wcf data service and a normal rest wcf service. Both services return the same entity object.

[DataContract]
public partial class MyEntity
{
    #region Primitive Properties
    [DataMember]
    public virtual long ID
    {
        get;
        set;
    }
    ....

The normal rest wcf service uses the following service contract:

[ServiceContract]
public interface MyService
{
    [OperationContract]
    [WebGet(UriTemplate="MyEntity/{id}",ResponseFormat=WebMessageFormat.Json)]
    public MyEntity GetMyEntity(string id)
}

while the wcf data service returns the long value as string:

{{"id": ... ,"uri": ... ,"type":"Model.MyEntity"},"ID":"865176660053852161"}

the MyService ServiceContract returns the long as number:

{ "ID":865176660053852161 }

Seems like the wcf data service and the “normal” rest service use two different kind of serialization mechanisms.

Problem is: My client app uses JavaScript and can therefore not handle 64bit numbers. I would have expected, that the “normal” rest service also would return 64bit numbers as string.

  • Where can I convert the number during the serialiuation/deserialization process to a string?
  • In case anyone knows: Why is the behaviour different between wcf data
    services / rest based wcf?

For consistency I would prefer a conversion during the serialization process on the serverside, but I don’t know if this is feasible.

  • 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-15T11:23:15+00:00Added an answer on June 15, 2026 at 11:23 am

    My workaround now is to adapt the t4 template for the poco generation, so that the entity objects are genereated like this:

    [DataContract]
    public partial class MyEntity
    {
        #region Primitive Properties
    
        public virtual long ID
        {
            get { return _iD; }
            set { _iD = value; _iDStr = value.ToString(); }
        }
    
        [DataMember(Name="ID")]
        private string _iDStr;
        private long _iD;
    
        ...
    

    This will return the ID as string in the WCF response, while the entity framework still works with the long value….

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

Sidebar

Related Questions

I have a simple WCF Data Services service and I want to expose a
I have a WCF service that can return large amount of data depending on
I have the following Wcf Data Service: public class WcfDataService : DataService<WcfDataServiceContext> { public
My WCF Data Service includes this: [WebGet] public MyClass GetClass() { return new MyClass();
I have a WCF Data Service that exposes an Entity Framework database context and
I have a WCF Data service operation : [WebGet] public bool isContractUpToDate(string contractId, string
I have a problem with my WCF Data Service, and this one is just
I have a Data Service created using WCF that internally uses nHibernate. This WCF
I have a WCF web-service and a Silverlight app displaying data from that service.
I have a WCF service that accesses a SQL database to fetch data .

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.