mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 14:04:44 +08:00
Add GetNullType
This commit is contained in:
parent
0cf9a96737
commit
baf4e3d45c
@ -363,6 +363,10 @@ namespace SqlSugar
|
||||
{
|
||||
return sql;
|
||||
}
|
||||
public virtual Type GetNullType(string tableName,string columnName)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
private void BuilderTree(StringBuilder builder,ConditionalTree item,ref int indexTree, List<SugarParameter> parameters,ref int mainIndex)
|
||||
{
|
||||
var conditionals = ToConditionalCollections(item,ref indexTree, parameters);
|
||||
|
@ -42,5 +42,6 @@ namespace SqlSugar
|
||||
void RepairReplicationParameters(ref string appendSql, SugarParameter[] parameters, int addIndex);
|
||||
KeyValuePair<string, SugarParameter[]> ConditionalModelToSql(List<IConditionalModel> models, int beginIndex = 0);
|
||||
string GetUnionFomatSql(string sql);
|
||||
Type GetNullType(string tableName,string columnName);
|
||||
}
|
||||
}
|
||||
|
@ -102,5 +102,21 @@ namespace SqlSugar
|
||||
{
|
||||
return " ( " + sql + " ) ";
|
||||
}
|
||||
|
||||
public override Type GetNullType(string tableName, string columnName)
|
||||
{
|
||||
var columnInfo=this.Context.DbMaintenance.GetColumnInfosByTableName(tableName).FirstOrDefault(z => z.DbColumnName.EqualCase(columnName));
|
||||
if (columnInfo != null)
|
||||
{
|
||||
var cTypeName=this.Context.Ado.DbBind.GetCsharpTypeName(UtilConstants.StringType.Name);
|
||||
var value=UtilMethods.ConvertDataByTypeName(cTypeName, "");
|
||||
if (value != null)
|
||||
{
|
||||
var key = "GetNullType_" + tableName + columnName;
|
||||
return new ReflectionInoCacheService().GetOrCreate(key, () => value.GetType());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user