@@ -24,12 +24,26 @@ public static void bindService<T>(string sessionID, Func<T> serviceFactory)
2424 List < Type > parameterTypeArray = new List < Type > ( ) ;
2525 for ( int i = 0 ; i < paramzs . Length ; i ++ )
2626 {
27+ string paramName ;
28+ var paramAttrs = paramzs [ i ] . GetCustomAttributes ( typeof ( JsonRpcParamAttribute ) , false ) ;
29+ if ( paramAttrs . Length > 0 )
30+ {
31+ paramName = ( ( JsonRpcParamAttribute ) paramAttrs [ 0 ] ) . JsonParamName ;
32+ if ( string . IsNullOrEmpty ( paramName ) )
33+ {
34+ paramName = paramzs [ i ] . Name ;
35+ }
36+ }
37+ else
38+ {
39+ paramName = paramzs [ i ] . Name ;
40+ }
2741 // reflection attribute information for optional parameters
2842 //http://stackoverflow.com/questions/2421994/invoking-methods-with-optional-parameters-through-reflection
29- paras . Add ( paramzs [ i ] . Name , paramzs [ i ] . ParameterType ) ;
43+ paras . Add ( paramName , paramzs [ i ] . ParameterType ) ;
3044
3145 if ( paramzs [ i ] . IsOptional ) // if the parameter is an optional, add the default value to our default values dictionary.
32- defaultValues . Add ( paramzs [ i ] . Name , paramzs [ i ] . DefaultValue ) ;
46+ defaultValues . Add ( paramName , paramzs [ i ] . DefaultValue ) ;
3347 }
3448
3549 var resType = meth . ReturnType ;
@@ -44,6 +58,7 @@ public static void bindService<T>(string sessionID, Func<T> serviceFactory)
4458 handlerSession . MetaData . AddService ( methodName , paras , defaultValues , newDel ) ;
4559 }
4660 }
61+
4762 }
4863 public static void bindService < T > ( string sessionID ) where T : new ( )
4964 {
0 commit comments