c# - Code generation for ClientBase<TChannel> and ChannelFactory<TChannel>? -
i studying usage pattern employed in clientbase , channelfactory , there 1 point cannot head around.
in examples, have usage
public class myclient : clientbase<imysvccontract>, imysvccontract { // imysvccontract interface method public string myoperation(int param) { return this.channel.myoperation(param); } } this example of client calling service method via channel. however, when closely, clientbase not have implementation of myoperation(), merely knows public interfaces defined in imysvccontract.
therefore, when this.channel.myoperation() called, block of code running? did generate code implement tchannel @ runtime? if so, how else can pattern achieved?"
edit: in simplest case, there 2 classes has implementation of isvccontract, client , server. not make sense pattern create either of object , type casting interface type, possible way actual code know of.
edit 2: after further research, learn possible generate class implements tchannel interface @ runtime. runtime code generation extent new me. reference. result, question changed slightly.
clientbase takes in service contract type parameter , exposes instance of type via channel property.
the channel proxy communication layer service.
the actual generation of proxy object happens in depths of clr (rather .net framework class library). i'm not sure how clr generates proxy it's pretty low-level stuff.
update:
i traced code through channel factories realproxy class, system.runtime.remoting.remotingservices class (mscorlib) , extern createtransparentproxy method work.
i learned bit discovering , share knowledge in sense "the block of code" not exist in .net framework, meant low-level.
Comments
Post a Comment