Wcf send object from Compact Framewok to Desktop WCF Service properties does not deserialize -


i have wcf service running on desktop pc. service has 2 methods

[system.codedom.compiler.generatedcodeattribute("system.servicemodel", "3.0.0.0")]
public interface imainmoduleservice
{
orderdto getorderbyid(int orderid);
void processorder(orderdto order);
}

i used necfsvcutil , generated proxy , poco's.

when use getorderbyid(int id) compact framework works, when use processorder(orderdto order) send order service although orderdto has properties values, when arrives on desktop service method, not deserialize properties of orderdto. orderdto.id==2050 before sending , arrives orderdto.id==0. noticed every int property value equals zero.

thank you!

i found problem, netcfsvcutil generates property name propertyname+specified every property in generated dto. ex.

[system.xml.serialization.xmlelementattribute(isnullable=true, order=20)] public system.nullable<int> salespersonid {         {         return this.salespersonidfield;     }     set     {         this.salespersonidfield = value;     } }  /// <remarks/> [system.xml.serialization.xmlignoreattribute()] public bool salespersonidspecified {         {         return this.salespersonidfieldspecified;     }     set     {         this.salespersonidfieldspecified = value;     } } 

these properties not part of entity used netcfsvcutil generate dto. if propertynamespecified not equal true property value not serialized, changed properties , added line in setter, checks if property has value , sets value of propertynamespecified true if has, below:

[system.xml.serialization.xmlelementattribute(isnullable=true, order=20)]
public system.nullable salespersonid
{
get
{
return this.salespersonidfield;
}
set
{
this.salespersonidfield = value;
this.salespersonidspecified = (value != null);
}
}


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -