Synchronization code

This commit is contained in:
sunkaixuan 2023-09-27 10:20:44 +08:00
parent 6e1dd336cf
commit ee58f08941
3 changed files with 13 additions and 1 deletions

View File

@ -23,6 +23,7 @@ namespace SqlSugar
private Func<string, string> FormatFileNameFunc { get; set; } private Func<string, string> FormatFileNameFunc { get; set; }
private bool IsStringNullable {get;set; } private bool IsStringNullable {get;set; }
private Func<DbColumnInfo,string,string,string> PropertyTextTemplateFunc { get; set; } private Func<DbColumnInfo,string,string,string> PropertyTextTemplateFunc { get; set; }
private Func<string, string> ReplaceClassStringFunc { get; set; }
private ISqlBuilder SqlBuilder private ISqlBuilder SqlBuilder
{ {
get get
@ -166,6 +167,11 @@ namespace SqlSugar
this.FormatFileNameFunc = formatFileNameFunc; this.FormatFileNameFunc = formatFileNameFunc;
return this; return this;
} }
public IDbFirst CreatedReplaceClassString(Func<string, string> replaceClassStringFunc)
{
this.ReplaceClassStringFunc = replaceClassStringFunc;
return this;
}
public IDbFirst IsCreateDefaultValue(bool isCreateDefaultValue = true) public IDbFirst IsCreateDefaultValue(bool isCreateDefaultValue = true)
{ {
this.IsDefaultValue = isCreateDefaultValue; this.IsDefaultValue = isCreateDefaultValue;
@ -219,6 +225,10 @@ namespace SqlSugar
string className = tableInfo.Name; string className = tableInfo.Name;
classText = GetClassString(tableInfo, ref className); classText = GetClassString(tableInfo, ref className);
result.Remove(className); result.Remove(className);
if (this.ReplaceClassStringFunc != null)
{
classText=this.ReplaceClassStringFunc(classText);
}
result.Add(className, classText); result.Add(className, classText);
} }
catch (Exception ex) catch (Exception ex)
@ -465,7 +475,7 @@ namespace SqlSugar
{ {
return "bool"; return "bool";
} }
if (result.EqualCase("char")) if (result.EqualCase("char")|| result.EqualCase("char?"))
{ {
return "string"; return "string";
} }

View File

@ -1480,6 +1480,7 @@ namespace SqlSugar
result.QueryBuilder.AppendNavInfo = this.QueryBuilder.AppendNavInfo; result.QueryBuilder.AppendNavInfo = this.QueryBuilder.AppendNavInfo;
result.QueryBuilder.LambdaExpressions.ParameterIndex = QueryBuilder.LambdaExpressions.ParameterIndex++; result.QueryBuilder.LambdaExpressions.ParameterIndex = QueryBuilder.LambdaExpressions.ParameterIndex++;
result.QueryBuilder.LambdaExpressions.Index = QueryBuilder.LambdaExpressions.Index++; result.QueryBuilder.LambdaExpressions.Index = QueryBuilder.LambdaExpressions.Index++;
result.QueryBuilder.IsCrossQueryWithAttr = QueryBuilder.IsCrossQueryWithAttr;
if (this.Context.CurrentConnectionConfig.DbType == DbType.Oracle) if (this.Context.CurrentConnectionConfig.DbType == DbType.Oracle)
{ {
result.Select("MergeTable.*"); result.Select("MergeTable.*");

View File

@ -26,5 +26,6 @@ namespace SqlSugar
void Init(); void Init();
IDbFirst FormatFileName(Func<string,string> formatFileNameFunc); IDbFirst FormatFileName(Func<string,string> formatFileNameFunc);
IDbFirst StringNullable(); IDbFirst StringNullable();
IDbFirst CreatedReplaceClassString(Func<string,string> replaceClassStringFunc);
} }
} }