File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
src/net45/WampSharp/WAMP2/V2/System.Reflection.DispatchProxy Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 11#if DISPATCH_PROXY
22
3+ using System ;
34using System . Reflection ;
45using WampSharp . V2 . Client ;
56
@@ -8,23 +9,32 @@ namespace WampSharp.V2.CalleeProxy
89{
910 internal class WampCalleeClientProxyFactory : IWampCalleeProxyFactory
1011 {
12+ private readonly IWampRealmProxy mProxy ;
1113 private readonly WampCalleeProxyInvocationHandler mHandler ;
1214
1315 public WampCalleeClientProxyFactory ( IWampRealmProxy proxy )
1416 {
17+ mProxy = proxy ;
1518 mHandler = new ClientInvocationHandler ( proxy ) ;
1619 }
1720
1821 public virtual TProxy GetProxy < TProxy > ( ICalleeProxyInterceptor interceptor ) where TProxy : class
1922 {
20- TProxy result = DispatchProxy . Create < TProxy , CalleeProxy > ( ) ;
23+ if ( typeof ( CalleeProxyBase ) . IsAssignableFrom ( typeof ( TProxy ) ) )
24+ {
25+ return ( TProxy ) Activator . CreateInstance ( typeof ( TProxy ) , mProxy , interceptor ) ;
26+ }
27+ else
28+ {
29+ TProxy result = DispatchProxy . Create < TProxy , CalleeProxy > ( ) ;
2130
22- CalleeProxy casted = result as CalleeProxy ;
31+ CalleeProxy casted = result as CalleeProxy ;
2332
24- casted . Handler = mHandler ;
25- casted . CalleeProxyInterceptor = interceptor ;
33+ casted . Handler = mHandler ;
34+ casted . CalleeProxyInterceptor = interceptor ;
2635
27- return result ;
36+ return result ;
37+ }
2838 }
2939 }
3040}
You can’t perform that action at this time.
0 commit comments