修复执行存储过程参数相关错误

This commit is contained in:
falcon 2022-04-08 12:22:12 +08:00
parent 0bcaef1383
commit 760b5b9b43

View File

@ -197,7 +197,16 @@ namespace Falcon.SugarApi.DatabaseDefinitions
/// <param name="otherParams">增加其他的参数</param> /// <param name="otherParams">增加其他的参数</param>
/// <returns>参数</returns> /// <returns>参数</returns>
public SugarParameter[] GetParameters<T>(T data, params SugarParameter[] otherParams) { public SugarParameter[] GetParameters<T>(T data, params SugarParameter[] otherParams) {
var result = data == null ? new List<SugarParameter>() : this.Ado.GetParameters(data).ToList(); var result = new List<SugarParameter>();
if (data != null) {
var dict = new Dictionary<string, object>();
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) { if (otherParams != null) {
result.AddRange(otherParams); result.AddRange(otherParams);
} }