mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-02 03:13:58 +08:00
-
This commit is contained in:
@@ -45,31 +45,20 @@ namespace SqlSugar
|
||||
if (parameters != null)
|
||||
{
|
||||
var entityType = parameters.GetType();
|
||||
var isDic = entityType.IsIn(PubConst.DicArraySO, PubConst.DicArraySS);
|
||||
if (isDic)
|
||||
var isDictionary = entityType.IsIn(PubConst.DicArraySO, PubConst.DicArraySS);
|
||||
if (isDictionary)
|
||||
{
|
||||
if (entityType == PubConst.DicArraySO)
|
||||
{
|
||||
var newObj = (Dictionary<string, object>)parameters;
|
||||
var pars = newObj.Select(it => new SugarParameter(sqlParameterKeyWord + it.Key, it.Value));
|
||||
foreach (var par in pars)
|
||||
{
|
||||
SetParameterSize(par);
|
||||
}
|
||||
listParams.AddRange(pars);
|
||||
DictionaryToParameters(parameters, sqlParameterKeyWord, listParams, entityType);
|
||||
}
|
||||
else
|
||||
{
|
||||
var newObj = (Dictionary<string, string>)parameters;
|
||||
var pars = newObj.Select(it => new SugarParameter(sqlParameterKeyWord + it.Key, it.Value));
|
||||
foreach (var par in pars)
|
||||
{
|
||||
SetParameterSize(par);
|
||||
}
|
||||
listParams.AddRange(pars); ;
|
||||
ProperyToParameter(parameters, propertyInfo, sqlParameterKeyWord, listParams, entityType);
|
||||
}
|
||||
}
|
||||
else
|
||||
return listParams.ToArray();
|
||||
}
|
||||
|
||||
protected void ProperyToParameter(object parameters, PropertyInfo[] propertyInfo, string sqlParameterKeyWord, List<SugarParameter> listParams, Type entityType)
|
||||
{
|
||||
PropertyInfo[] propertiesObj = null;
|
||||
if (propertyInfo != null)
|
||||
@@ -108,8 +97,28 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
}
|
||||
protected void DictionaryToParameters(object parameters, string sqlParameterKeyWord, List<SugarParameter> listParams, Type entityType)
|
||||
{
|
||||
if (entityType == PubConst.DicArraySO)
|
||||
{
|
||||
var newObj = (Dictionary<string, object>)parameters;
|
||||
var pars = newObj.Select(it => new SugarParameter(sqlParameterKeyWord + it.Key, it.Value));
|
||||
foreach (var par in pars)
|
||||
{
|
||||
SetParameterSize(par);
|
||||
}
|
||||
listParams.AddRange(pars);
|
||||
}
|
||||
else
|
||||
{
|
||||
var newObj = (Dictionary<string, string>)parameters;
|
||||
var pars = newObj.Select(it => new SugarParameter(sqlParameterKeyWord + it.Key, it.Value));
|
||||
foreach (var par in pars)
|
||||
{
|
||||
SetParameterSize(par);
|
||||
}
|
||||
listParams.AddRange(pars); ;
|
||||
}
|
||||
return listParams.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user