mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Db.First support string append "?"
This commit is contained in:
parent
c6c8cb5f5f
commit
3f9d2a48bd
@ -21,6 +21,7 @@ namespace SqlSugar
|
||||
private bool IsDefaultValue { get; set; }
|
||||
private Func<string, bool> WhereColumnsfunc;
|
||||
private Func<string, string> FormatFileNameFunc { get; set; }
|
||||
private bool IsStringNullable {get;set;}
|
||||
private ISqlBuilder SqlBuilder
|
||||
{
|
||||
get
|
||||
@ -56,6 +57,11 @@ namespace SqlSugar
|
||||
}
|
||||
|
||||
#region Setting Template
|
||||
public IDbFirst StringNullable()
|
||||
{
|
||||
IsStringNullable = true;
|
||||
return this;
|
||||
}
|
||||
public IDbFirst SettingClassDescriptionTemplate(Func<string, string> func)
|
||||
{
|
||||
this.ClassDescriptionTemplate = func(this.ClassDescriptionTemplate);
|
||||
@ -421,12 +427,16 @@ namespace SqlSugar
|
||||
}
|
||||
if (result == "Int32")
|
||||
{
|
||||
result = "int";
|
||||
result = item.IsNullable?"int?":"int";
|
||||
}
|
||||
if (result == "String")
|
||||
{
|
||||
result = "string";
|
||||
}
|
||||
if (result == "string" && item.IsNullable && IsStringNullable)
|
||||
{
|
||||
result = result + "?";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private string GetPropertyTypeConvert(DbColumnInfo item)
|
||||
|
@ -24,5 +24,6 @@ namespace SqlSugar
|
||||
Dictionary<string, string> ToClassStringList(string nameSpace = "Models");
|
||||
void Init();
|
||||
IDbFirst FormatFileName(Func<string,string> formatFileNameFunc);
|
||||
IDbFirst StringNullable();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user