mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 20:38:16 +08:00
- 优化 GetDbParamtersByObject 参数为字典时修剪 @?: 前辍 #456;
This commit is contained in:
@ -1230,11 +1230,12 @@ namespace FreeSql.Internal
|
||||
{
|
||||
foreach (var key in dic.Keys)
|
||||
{
|
||||
if (isCheckSql && string.IsNullOrEmpty(paramPrefix) == false && sql.IndexOf($"{paramPrefix}{key}", StringComparison.CurrentCultureIgnoreCase) == -1) continue;
|
||||
var dbkey = key.ToString().TrimStart('@', '?', ':');
|
||||
if (isCheckSql && string.IsNullOrEmpty(paramPrefix) == false && sql.IndexOf($"{paramPrefix}{dbkey}", StringComparison.CurrentCultureIgnoreCase) == -1) continue;
|
||||
var val = dic[key];
|
||||
var valType = val == null ? typeof(string) : val.GetType();
|
||||
if (valType == ttype) ret.Add((T)Convert.ChangeType(val, ttype));
|
||||
else ret.Add(constructorParamter(key.ToString(), valType, val));
|
||||
else ret.Add(constructorParamter(dbkey, valType, val));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user