mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-23 04:23:47 +08:00
SugarColumn Add SqlParameterDbType
This commit is contained in:
@@ -281,6 +281,7 @@ namespace SqlSugar
|
|||||||
column.IsOnlyIgnoreUpdate = sugarColumn.IsOnlyIgnoreUpdate;
|
column.IsOnlyIgnoreUpdate = sugarColumn.IsOnlyIgnoreUpdate;
|
||||||
column.IsArray = sugarColumn.IsArray;
|
column.IsArray = sugarColumn.IsArray;
|
||||||
column.IsTreeKey = sugarColumn.IsTreeKey;
|
column.IsTreeKey = sugarColumn.IsTreeKey;
|
||||||
|
column.SqlParameterDbType = sugarColumn.SqlParameterDbType;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -21,6 +21,7 @@ namespace SqlSugar
|
|||||||
public bool IsPrimarykey { get; set; }
|
public bool IsPrimarykey { get; set; }
|
||||||
public bool IsTreeKey { get; set; }
|
public bool IsTreeKey { get; set; }
|
||||||
public bool IsEnableUpdateVersionValidation { get; set; }
|
public bool IsEnableUpdateVersionValidation { get; set; }
|
||||||
|
public object SqlParameterDbType { get; set; }
|
||||||
public string EntityName { get; set; }
|
public string EntityName { get; set; }
|
||||||
public string DbTableName { get; set; }
|
public string DbTableName { get; set; }
|
||||||
public bool IsIgnore { get; set; }
|
public bool IsIgnore { get; set; }
|
||||||
|
@@ -196,6 +196,8 @@ namespace SqlSugar
|
|||||||
get { return _IsTreeKey; }
|
get { return _IsTreeKey; }
|
||||||
set { _IsTreeKey = value; }
|
set { _IsTreeKey = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public object SqlParameterDbType { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -170,7 +170,15 @@ namespace SqlSugar
|
|||||||
+ Context.ParameterIndex;
|
+ Context.ParameterIndex;
|
||||||
if (value.ObjToString() != "NULL" && !parameter.ValueIsNull)
|
if (value.ObjToString() != "NULL" && !parameter.ValueIsNull)
|
||||||
{
|
{
|
||||||
this.Context.Parameters.Add(new SugarParameter(appendValue, value));
|
EntityColumnInfo columnInfo = GetColumnInfo(oppoSiteExpression);
|
||||||
|
if (columnInfo != null && columnInfo.SqlParameterDbType != null&& columnInfo.SqlParameterDbType is System.Data.DbType)
|
||||||
|
{
|
||||||
|
this.Context.Parameters.Add(new SugarParameter(appendValue, value, (System.Data.DbType)columnInfo.SqlParameterDbType));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Context.Parameters.Add(new SugarParameter(appendValue, value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -251,6 +259,19 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private EntityColumnInfo GetColumnInfo(Expression oppoSiteExpression)
|
||||||
|
{
|
||||||
|
var oppsite = (oppoSiteExpression as MemberExpression);
|
||||||
|
if (oppsite == null) return null;
|
||||||
|
if (this.Context.SugarContext == null) return null;
|
||||||
|
if (this.Context.SugarContext.Context == null) return null;
|
||||||
|
if (oppsite.Expression == null) return null;
|
||||||
|
var columnInfo = this.Context.SugarContext.Context.EntityMaintenance
|
||||||
|
.GetEntityInfo(oppsite.Expression.Type).Columns.FirstOrDefault(it => it.PropertyName == oppsite.Member.Name);
|
||||||
|
return columnInfo;
|
||||||
|
}
|
||||||
|
|
||||||
protected void AppendOpreator(ExpressionParameter parameter, bool? isLeft)
|
protected void AppendOpreator(ExpressionParameter parameter, bool? isLeft)
|
||||||
{
|
{
|
||||||
if (isLeft == true)
|
if (isLeft == true)
|
||||||
|
Reference in New Issue
Block a user