mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 05:13:27 +08:00
-
This commit is contained in:
parent
be29201171
commit
32d2a8b4ee
@ -16,7 +16,7 @@ namespace SqlSugar
|
|||||||
protected IDbMaintenance _DbMaintenance;
|
protected IDbMaintenance _DbMaintenance;
|
||||||
protected IDbConnection _DbConnection;
|
protected IDbConnection _DbConnection;
|
||||||
|
|
||||||
protected virtual SugarParameter[] GetParameters(object parameters, PropertyInfo[] propertyInfo,string sqlParameterKeyWord)
|
protected virtual SugarParameter[] GetParameters(object parameters, PropertyInfo[] propertyInfo, string sqlParameterKeyWord)
|
||||||
{
|
{
|
||||||
List<SugarParameter> result = new List<SugarParameter>();
|
List<SugarParameter> result = new List<SugarParameter>();
|
||||||
if (parameters != null)
|
if (parameters != null)
|
||||||
@ -24,13 +24,9 @@ namespace SqlSugar
|
|||||||
var entityType = parameters.GetType();
|
var entityType = parameters.GetType();
|
||||||
var isDictionary = entityType.IsIn(UtilConstants.DicArraySO, UtilConstants.DicArraySS);
|
var isDictionary = entityType.IsIn(UtilConstants.DicArraySO, UtilConstants.DicArraySS);
|
||||||
if (isDictionary)
|
if (isDictionary)
|
||||||
{
|
|
||||||
DictionaryToParameters(parameters, sqlParameterKeyWord, result, entityType);
|
DictionaryToParameters(parameters, sqlParameterKeyWord, result, entityType);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
ProperyToParameter(parameters, propertyInfo, sqlParameterKeyWord, result, entityType);
|
ProperyToParameter(parameters, propertyInfo, sqlParameterKeyWord, result, entityType);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result.ToArray();
|
return result.ToArray();
|
||||||
}
|
}
|
||||||
@ -38,20 +34,15 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
PropertyInfo[] properties = null;
|
PropertyInfo[] properties = null;
|
||||||
if (propertyInfo != null)
|
if (propertyInfo != null)
|
||||||
{
|
|
||||||
properties = propertyInfo;
|
properties = propertyInfo;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
properties = entityType.GetProperties();
|
properties = entityType.GetProperties();
|
||||||
}
|
|
||||||
foreach (PropertyInfo properyty in properties)
|
foreach (PropertyInfo properyty in properties)
|
||||||
{
|
{
|
||||||
var value = properyty.GetValue(parameters, null);
|
var value = properyty.GetValue(parameters, null);
|
||||||
if (properyty.PropertyType.IsEnum())
|
if (properyty.PropertyType.IsEnum())
|
||||||
{
|
|
||||||
value = Convert.ToInt64(value);
|
value = Convert.ToInt64(value);
|
||||||
}
|
|
||||||
if (value == null || value.Equals(DateTime.MinValue)) value = DBNull.Value;
|
if (value == null || value.Equals(DateTime.MinValue)) value = DBNull.Value;
|
||||||
if (properyty.Name.ToLower().Contains("hierarchyid"))
|
if (properyty.Name.ToLower().Contains("hierarchyid"))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user