c# - Failure to pass WCF DataMembers -


problem: not datamembers in wcf datacontract class failing pass properly.

[servicecontract] public interface ichecklist {     [operationcontract]     int upsertmanager(managerentity newobj); }  [datacontract] [serializable] public class managerentity {     [datamember] public bool trainingcomplete{get;set;}     [datamember] public int isposted{get;set;}     [datamember] public datetime trainingdate{get;set;}     [datamember] public string comments{get;set;} } 

client side code:

brtwslchecklist.managerentity newmodel = new brtwslchecklist.managerentity(); newmodel.trainingcomplete = model.hastrainingdate; newmodel.comments = model.comments; newmodel.isposted = 1; newmodel.trainingdate = datetime.today;  checklistclient.upsertmanager(newmodel); 

wcf side:

public int upsertmanager(managerentity newobj) {     bool t = newobj.trainingcomplete;   //always false     datetime x = newobj.trainingdate;   //always equal 1/1/0001     string c = newobj.comments;         //no problems here      int d = newobj.isposted;            //no problems here } 

any ideas why 2 out of 4 ok, bools , datetimes failing??

does client side code have properties trainingcompletespecified , trainingdatespecified?

if so: must set true when you've specified values properties...

for types of properties, wcf cannot distinguish between having not specified value, or having specified value can "nothing". therefore, these kinds of properties, wcf client-side runtime adds bool (property)specified properties client-side code; if want pass value server, these (property)specified properties must set true - otherwise, values set ignored / not seen on server side.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -