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)
|
if (parameters != null)
|
||||||
{
|
{
|
||||||
var entityType = parameters.GetType();
|
var entityType = parameters.GetType();
|
||||||
var isDic = entityType.IsIn(PubConst.DicArraySO, PubConst.DicArraySS);
|
var isDictionary = entityType.IsIn(PubConst.DicArraySO, PubConst.DicArraySS);
|
||||||
if (isDic)
|
if (isDictionary)
|
||||||
{
|
{
|
||||||
if (entityType == PubConst.DicArraySO)
|
DictionaryToParameters(parameters, sqlParameterKeyWord, listParams, entityType);
|
||||||
{
|
|
||||||
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
|
else
|
||||||
{
|
{
|
||||||
var newObj = (Dictionary<string, string>)parameters;
|
ProperyToParameter(parameters, propertyInfo, sqlParameterKeyWord, listParams, entityType);
|
||||||
var pars = newObj.Select(it => new SugarParameter(sqlParameterKeyWord + it.Key, it.Value));
|
|
||||||
foreach (var par in pars)
|
|
||||||
{
|
|
||||||
SetParameterSize(par);
|
|
||||||
}
|
|
||||||
listParams.AddRange(pars); ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
return listParams.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ProperyToParameter(object parameters, PropertyInfo[] propertyInfo, string sqlParameterKeyWord, List<SugarParameter> listParams, Type entityType)
|
||||||
{
|
{
|
||||||
PropertyInfo[] propertiesObj = null;
|
PropertyInfo[] propertiesObj = null;
|
||||||
if (propertyInfo != 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