File tree 1 file changed +15
-5
lines changed
src/net45/WampSharp/WAMP2/V2/System.Reflection.DispatchProxy
1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 1
1
#if DISPATCH_PROXY
2
2
3
+ using System ;
3
4
using System . Reflection ;
4
5
using WampSharp . V2 . Client ;
5
6
@@ -8,23 +9,32 @@ namespace WampSharp.V2.CalleeProxy
8
9
{
9
10
internal class WampCalleeClientProxyFactory : IWampCalleeProxyFactory
10
11
{
12
+ private readonly IWampRealmProxy mProxy ;
11
13
private readonly WampCalleeProxyInvocationHandler mHandler ;
12
14
13
15
public WampCalleeClientProxyFactory ( IWampRealmProxy proxy )
14
16
{
17
+ mProxy = proxy ;
15
18
mHandler = new ClientInvocationHandler ( proxy ) ;
16
19
}
17
20
18
21
public virtual TProxy GetProxy < TProxy > ( ICalleeProxyInterceptor interceptor ) where TProxy : class
19
22
{
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 > ( ) ;
21
30
22
- CalleeProxy casted = result as CalleeProxy ;
31
+ CalleeProxy casted = result as CalleeProxy ;
23
32
24
- casted . Handler = mHandler ;
25
- casted . CalleeProxyInterceptor = interceptor ;
33
+ casted . Handler = mHandler ;
34
+ casted . CalleeProxyInterceptor = interceptor ;
26
35
27
- return result ;
36
+ return result ;
37
+ }
28
38
}
29
39
}
30
40
}
You can’t perform that action at this time.
0 commit comments