From 04a272a780d20dbc5b3fdb51446996c9c1730454 Mon Sep 17 00:00:00 2001 From: Savorboard Date: Wed, 16 Sep 2020 17:37:23 +0800 Subject: [PATCH] Add determines whether the subscriber parameter is an instance of the current type. #669 --- src/DotNetCore.CAP/Internal/ISubscribeInvoker.Default.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/DotNetCore.CAP/Internal/ISubscribeInvoker.Default.cs b/src/DotNetCore.CAP/Internal/ISubscribeInvoker.Default.cs index b1ef187..bbaeb6b 100644 --- a/src/DotNetCore.CAP/Internal/ISubscribeInvoker.Default.cs +++ b/src/DotNetCore.CAP/Internal/ISubscribeInvoker.Default.cs @@ -73,7 +73,14 @@ namespace DotNetCore.CAP.Internal } else { - executeParameters[i] = Convert.ChangeType(message.Value, parameterDescriptors[i].ParameterType); + if (parameterDescriptors[i].ParameterType.IsInstanceOfType(message.Value)) + { + executeParameters[i] = message.Value; + } + else + { + executeParameters[i] = Convert.ChangeType(message.Value, parameterDescriptors[i].ParameterType); + } } } }