webAPI怎样做到统一接口调用
发布网友
发布时间:2022-04-29 03:25
我来回答
共1个回答
热心网友
时间:2023-10-09 04:26
伪代码会有跳转。
用反射。
系统按照reqtype建立类,类名=reqtype,方法名=reqtype
传入reqtype。
反射
'程序集=HEALTH
Dim _Assembly As Assembly = Assembly.Load("HEALTH")
'类名=“C_" & reqtype
Dim _type As Type = _Assembly.GetType("HEALTH.C_" & reqtype)
Dim _Object As Object = Activator.CreateInstance(_type)
'方法名=“ReqType_" & reqtype
Dim _MethodInfo As MethodInfo = _type.GetMethod("ReqType_" & reqtype)
'传入参数
Dim pobj As Object()
pobj = New Object(0) {}
pobj(0) = json
_MethodInfo.Invoke(_Object, pobj)
热心网友
时间:2023-10-09 04:26
伪代码会有跳转。
用反射。
系统按照reqtype建立类,类名=reqtype,方法名=reqtype
传入reqtype。
反射
'程序集=HEALTH
Dim _Assembly As Assembly = Assembly.Load("HEALTH")
'类名=“C_" & reqtype
Dim _type As Type = _Assembly.GetType("HEALTH.C_" & reqtype)
Dim _Object As Object = Activator.CreateInstance(_type)
'方法名=“ReqType_" & reqtype
Dim _MethodInfo As MethodInfo = _type.GetMethod("ReqType_" & reqtype)
'传入参数
Dim pobj As Object()
pobj = New Object(0) {}
pobj(0) = json
_MethodInfo.Invoke(_Object, pobj)
热心网友
时间:2023-10-09 04:26
伪代码会有跳转。
用反射。
系统按照reqtype建立类,类名=reqtype,方法名=reqtype
传入reqtype。
反射
'程序集=HEALTH
Dim _Assembly As Assembly = Assembly.Load("HEALTH")
'类名=“C_" & reqtype
Dim _type As Type = _Assembly.GetType("HEALTH.C_" & reqtype)
Dim _Object As Object = Activator.CreateInstance(_type)
'方法名=“ReqType_" & reqtype
Dim _MethodInfo As MethodInfo = _type.GetMethod("ReqType_" & reqtype)
'传入参数
Dim pobj As Object()
pobj = New Object(0) {}
pobj(0) = json
_MethodInfo.Invoke(_Object, pobj)