dto - WCF and Data Transfer Object -


i stuck on simple question. in console application, want consume wcf service. add web reference project , call it. it.

but why saw examples using restsharp, never add web reference. use called "dto" return object service , consume it.

i hope can clarify concepts me. dto used inside wcf?

sample:

private static list<applicationdto> features; restclient client = new restclient("http://" + baseurl + "/facilitydata.svc"); var request = new restrequest(method.get); request.resource = "/getfeatures"; request.parameters.clear(); request.addparameter("id", 888); var response = client.execute(request); features = jsonconvert.deserializeobject<list<applicationdto>>(response.content); 

from this post:

for rest service, provides generic way wcf service consuming doesn't rely on soap. that's why no longer need "add servicereference..." consuming it. rest service operations can accessed through standard http get/post request, webrequest enabled client can consume it. example, can use httpwebrequest invoke rest operation , use linq xml load , extract values response xml data. it's flexible.

dto, used data transfer object - nothing more entity want pass parameter / receive result.

in example, applicationdto - entity hold data application feature object (name, type, ...)


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -