c# - Does WCF call dispose on transmitted and received objects? -


we have contract passing large object using streaming. service , message contracts boil down this.

[servicecontract] public interface idata {     [operationcontract]     item get(itemrequest request);      [operationcontract]     void put(item request); }  [messagecontract] public class item: idisposable {     [messagebodymember(order = 1)]     public stream filebytestream;      public void dispose() {...} } 

the item class provides standard implementation of disposable pattern. question wcf call dispose method of item class. wcf via servicehost taking responsibility passing , receiving item object our service contract implementation.

there many examples on web (such this), none of them ever call dispose or mention if occurs.

wcf doesn't "take responsibility" object. wcf merely serializes object pass on 1 side, , creates new on other side.

there's nothing wcf can take ownership of.. i'm not sure why think wcf have reason dispose object passed it.

usually, this:

var proxy = new myservice();  var myobject = new myobject();  proxy.send(myobject);  // here myobject still alive, , can still things it..  

edit:

it occurs me talking returned value service. in case, yes.. default wcf call dispose on both parameters passed in , returned parameters. however, controlled operationbehaviorattribute.autodisposeparameters property, defaults true.

if set false, responsible calling dispose, typically in operationcontext.operationcompleted event handler.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -