Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
Thick-Common
Commits
73454d5d
Commit
73454d5d
authored
Oct 22, 2020
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复 GetMethodInfo 方法重载调用 修改
parent
cac989ca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
19 deletions
+21
-19
Reflect_Proxy.cs
Project.FLY.FObjSys/FObjBaseReflect/Reflect_Proxy.cs
+17
-19
Reflect_SeviceClient.cs
Project.FLY.FObjSys/FObjBaseReflect/Reflect_SeviceClient.cs
+4
-0
No files found.
Project.FLY.FObjSys/FObjBaseReflect/Reflect_Proxy.cs
View file @
73454d5d
...
@@ -333,27 +333,25 @@ namespace FObjBase.Reflect
...
@@ -333,27 +333,25 @@ namespace FObjBase.Reflect
foreach
(
var
methodInfo
in
methodInfos
)
foreach
(
var
methodInfo
in
methodInfos
)
{
{
var
parameterInfos
=
methodInfo
.
GetParameters
();
var
parameterInfos
=
methodInfo
.
GetParameters
();
var
names
=
parameterInfos
.
Select
(
pi
=>
pi
.
Name
);
//全部参数名称
var
names
=
parameterInfos
.
Select
(
pi
=>
pi
.
Name
).
ToList
();
//删除掉 asyncDelegate,asyncContext
names
.
Remove
(
"asyncDelegate"
);
names
.
Remove
(
"asyncContext"
);
var
names_req
=
parameterNames
;
var
names_req
=
parameterNames
;
//比较 names 与 names_data
var
exps_req
=
names_req
.
Except
(
names
);
if
(
names
.
Count
()
!=
names_req
.
Count
())
if
(
exps_req
.
Count
()
!=
0
)
continue
;
//数量不一致,肯定不同
{
//请求的参数,这个method 不是全部都有
var
sames
=
names_req
.
Intersect
(
names
);
continue
;
}
if
(
sames
.
Count
()
!=
names_req
.
Count
())
var
exps
=
names
.
Except
(
names_req
);
continue
;
// names 与 names_req 的交集数量与names_req不一样,肯定不同
if
(
exps
.
Count
()
==
2
&&
exps
.
Contains
(
"asyncDelegate"
)
&&
exps
.
Contains
(
"asyncContext"
))
{
//就是它
//请求的参数 就只有 "asyncDelegate" 与 "asyncContext" 没有而已
return
methodInfo
;
//这个就是需要调用的 method
return
methodInfo
;
}
else
{
continue
;
}
}
}
return
null
;
return
null
;
}
}
...
...
Project.FLY.FObjSys/FObjBaseReflect/Reflect_SeviceClient.cs
View file @
73454d5d
...
@@ -330,6 +330,10 @@ namespace FObjBase.Reflect
...
@@ -330,6 +330,10 @@ namespace FObjBase.Reflect
//触发事件!!!
//触发事件!!!
var
methodInfo
=
GetType
().
GetMethod
(
anyEvent
.
triggerName
);
var
methodInfo
=
GetType
().
GetMethod
(
anyEvent
.
triggerName
);
if
(
methodInfo
==
null
)
{
throw
new
Exception
(
$"客户端
{
GetType
()}
忘记写
{
anyEvent
.
triggerName
}
"
);
}
var
obj
=
rData
.
data
.
ToObject
(
anyEvent
.
retType
);
var
obj
=
rData
.
data
.
ToObject
(
anyEvent
.
retType
);
//出错,就提示,肯定是客户端忘记写 "Trigger_XXXX"
//出错,就提示,肯定是客户端忘记写 "Trigger_XXXX"
methodInfo
.
Invoke
(
this
,
new
object
[]
{
obj
});
methodInfo
.
Invoke
(
this
,
new
object
[]
{
obj
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment