From 9b1b54c5eca3fea92ff94dba4547849b524b8cff Mon Sep 17 00:00:00 2001 From: falcon <9504402@qq.com> Date: Mon, 14 Dec 2020 09:43:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=B8=AA=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E8=BF=87=E7=A8=8B=E5=8F=82=E6=95=B0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Falcon.StoredProcedureRunner/Runner.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Falcon.StoredProcedureRunner/Runner.cs b/src/Falcon.StoredProcedureRunner/Runner.cs index 704b6dc..9bad42f 100644 --- a/src/Falcon.StoredProcedureRunner/Runner.cs +++ b/src/Falcon.StoredProcedureRunner/Runner.cs @@ -21,7 +21,7 @@ namespace Falcon.StoredProcedureRunner /// 数据上下文 /// 参数数据 public int Execute(DbContext db,TPrarmType data) { - var parms = getParams(data).ToArray(); + var parms = getParams(typeof(TPrarmType),data).ToArray(); var pName = getProcuderName(); #if NETSTANDARD2_1 @@ -75,7 +75,7 @@ namespace Falcon.StoredProcedureRunner /// 查询结果枚举 public IEnumerable Run(DbContext db,Type prarmType,Type returnType,object data) { var pm = getProcuderName(prarmType); - var paras = getParams(data).ToArray(); + var paras = getParams(prarmType,data).ToArray(); var connection = db.Database.GetDbConnection(); using(var cmd = connection.CreateCommand()) { cmd.CommandText = pm; @@ -134,12 +134,12 @@ namespace Falcon.StoredProcedureRunner /// /// 获取存储过程参数枚举 /// - /// 参数模型类型 + ///数据的类型 /// 参数实例 - private static IEnumerable getParams(T data) { + private static IEnumerable getParams(Type type,object data) { if(data == null) yield break; - foreach(var p in typeof(T).GetProperties()) { + foreach(var p in type.GetProperties()) { if(!p.CanRead || ignoreProp(p)) continue; var pt = getPrarmType(p);