c# - Can I return a TransparentProxy from a WCF service method? -
i've set wcf windows service assemblies hot-swappable method described in this answer. 1 of service methods sensitive performance , typically returns large, complex object graph marshaled outer app domain value.
i'm encountering issue overhead of marshaling adding on time in order of seconds tens of seconds, unacceptable consumers of service.
working off assumption payload can't reduced in size, there way can improve performance of without sacrificing hot deployability of service?
as 1 possibility, started considering whether possible marshal object graph reference instead , have wcf return - doing serialization on side of inner app domain , avoid need double serialization, unable work (i greeted cryptic socket timeout errors). approach possible?
example code give idea of mean:
[datacontract] public class complexobject { // stuff } public class marshalbyreflistofcomplexobject : marshalbyrefobject, ilist<complexobject> { private readonly list<complexobject> _objects; public marshalbyreflistofcomplexobject(list<complexobject> objects) => _objects = objects; // delegating implementation of ilist onto _objects } [servicecontract] public interface iservice { [operationcontract] ilist<complexobject> somemethod(); } public class service : marshalbyrefobject, iservice { public ilist<complexobject> somemethod() { return new marshalbyreflistofcomplexobject(getobjects()); } private list<complexobject> getobjects() => new list<complexobject>(); // long list } [servicebehavior(includeexceptiondetailinfaults = true, instancecontextmode = instancecontextmode.single)] public class hotswappingservice : iservice // root service class { private service _innerservice; public ilist<complexobject> somemethod() => _innerservice.somemethod(); // logic setting _innerservice appropriate on startup , when hot-deployed transparentproxy inner appdomain }
Comments
Post a Comment