channelfactory - Configure WCF without using config file and instantiating proxy client with default constructor -
i not sure possible honest,
i wondering if there way of removing use of config file without having override creation of client proxy. let me give example:
in client app have wcf dal project. wrapper wcf server client app consume. @ present client app need bindings , endpoints given in config file , (in our projects) following wrap wcf service:
public myobject getmyobject(int id) { using(var service = new myobjectdataserviceclient()) { return service.getmyobject(id); } }
this create call server , object back. if client app didn't have bindings , endpoints blow up. change each creation of data service client create binding , endpoint, or create our own chanelfactory means changing current wcf dal layer code.
my goal try , create way of inserting process wcf dal layer handle bindings , endpoints without consuming code having change, whilst removing need config file.
my thoughts far try , use tt file create partial class of data service client , override channel factory part. failed because of constructor call data service client goes straight abstract class (system.servicemodel.clientbase<t>) , tries config stuff out. not find way of stopping looking in config via partial class , not changing wcf dal service layer.
if have binding , endpoint @ dal, can use different constructor of client class (one takes binding + endpoint address). constructor bypasses configuration, don't need have in config.
Comments
Post a Comment