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);