none
Integer values are becoming null or 0 at the server side RRS feed

  • Question

  • Hi,

    i have a proxy object which is having some integer fields in it. just before calling the service method this values are neither zero nor null. However the moment the control goes to the service side these values are becoming 0. please advice

    Wednesday, October 16, 2013 9:59 AM

Answers

  • I found the solution. in wcf 4.5 we have a new set of attributes gets created. suppose if int variable is TypeId, a new boolean variable in the proxy like TypeIdSpecified will be created which we need to set to true like

    TypeId=25;

    TypeIdSpecified=true;

    Thursday, October 17, 2013 1:42 PM

All replies

  • Hi,

    If I do not misunderstand you, please try to refer to the following:

    In WCf, Data Member have a concept of default values. For example, for any reference type the default value is null, and for an integer type it is zero. It is occasionally desirable to omit a data member from serialized data when it is set to its default value. Because the member has a default value, an actual value need not be serialized; this has a performance advantage.

    For more information, please try to refer to:
    #Data Member Default Values:
    http://msdn.microsoft.com/en-us/library/aa347792.aspx .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, October 17, 2013 7:02 AM
    Moderator
  • I found the solution. in wcf 4.5 we have a new set of attributes gets created. suppose if int variable is TypeId, a new boolean variable in the proxy like TypeIdSpecified will be created which we need to set to true like

    TypeId=25;

    TypeIdSpecified=true;

    Thursday, October 17, 2013 1:42 PM
  • Hi,

    Well Done!

    Please mark it as answer.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, October 18, 2013 2:12 AM
    Moderator