From 760b5b9b43371747d725711c0f96660c96467965 Mon Sep 17 00:00:00 2001 From: falcon <9504402@qq.com> Date: Fri, 8 Apr 2022 12:22:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=A7=E8=A1=8C=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E8=BF=87=E7=A8=8B=E5=8F=82=E6=95=B0=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Falcon.SugarApi/DatabaseDefinitions/SugarDbContext.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Falcon.SugarApi/DatabaseDefinitions/SugarDbContext.cs b/Falcon.SugarApi/DatabaseDefinitions/SugarDbContext.cs index ddb4ad4..329c2d5 100644 --- a/Falcon.SugarApi/DatabaseDefinitions/SugarDbContext.cs +++ b/Falcon.SugarApi/DatabaseDefinitions/SugarDbContext.cs @@ -197,7 +197,16 @@ namespace Falcon.SugarApi.DatabaseDefinitions /// 增加其他的参数 /// 参数 public SugarParameter[] GetParameters(T data, params SugarParameter[] otherParams) { - var result = data == null ? new List() : this.Ado.GetParameters(data).ToList(); + var result = new List(); + if (data != null) { + var dict = new Dictionary(); + foreach (var p in data.GetType().GetProperties()) { + if (p.CanRead) { + dict.Add(p.Name, p.GetValue(data) ?? ""); + } + } + result.AddRange(this.Ado.GetParameters(dict).ToArray()); + } if (otherParams != null) { result.AddRange(otherParams); }