OData POST doesn't set last property of object using a Asp.Net ApiController -
i have following xml document, submitted ( post ) system.web.http.apicontroller.
the code of controller ( post ) pretty basic:
<responsetype(gettype(representative))> function postrepresentative(byval model representative) ihttpactionresult if not modelstate.isvalid return badrequest(modelstate) end if representativerepository.add(model) unitofwork.commit() ' db.representative.add(representative) ' db.savechangesasync() return createdatroute("defaultapi", new {.id = model.id}, model) end function
and here document i'm submitting in post
<?xml version="1.0" encoding="utf-8"?> <representative xmlns="http://schemas.datacontract.org/2004/07/omnisoft.domain.slave" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <id>8</id> <commission>10</commission> <email /> <receiveinvoice>true</receiveinvoice> <receivedeliverynotice>true</receivedeliverynotice> <receiveestimate>true</receiveestimate> <receiveorderconfirmation>true</receiveorderconfirmation> <receiverappel>true</receiverappel> <receivecollectedbilling>true</receivecollectedbilling> <receiveworkorder>false</receiveworkorder> <name>testing</name> </representative>
this corresponding model:
public class representative <key, databasegenerated(databasegeneratedoption.identity)> _ public property id integer public property name string <localizeddisplayname("commission", nameresourcetype:=gettype(viewres.representativevalue))> public property commission double <datatype(datatype.emailaddress)> _ public property email string public property receiveestimate boolean public property receiveorderconfirmation boolean public property receivedeliverynotice boolean public property receiveinvoice boolean public property receivecollectedbilling boolean public property receiveworkorder boolean public property receiverappel boolean end class
when xml document puts name last property, doesn't submitted in model. when it's submitted @ top of xml file. odata can "parse/serialize" property , there no problem.
otherwhise, added entity contains nil value name.
any ideas be?
i used different xml serializer , worked.
Comments
Post a Comment