mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-05 17:37:58 +08:00
Synchronization code
This commit is contained in:
parent
036e82fbf0
commit
531735a187
@ -573,6 +573,10 @@ namespace SqlSugar
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (properyTypeName?.ToLower() == "varchar" && dataType?.ToLower() == "nvarchar")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (properyTypeName?.ToLower() == "number" && dataType?.ToLower() == "decimal")
|
||||
{
|
||||
return false;
|
||||
|
@ -18,5 +18,6 @@ namespace SqlSugar
|
||||
public bool? TableEnumIsString { get; set; }
|
||||
public DateTime? DbMinDate { get; set; } = Convert.ToDateTime("1900-01-01");
|
||||
public bool IsNoReadXmlDescription { get; set; }
|
||||
public bool SqlServerCodeFirstNvarchar { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -321,6 +321,17 @@ namespace SqlSugar
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public override bool UpdateColumn(string tableName, DbColumnInfo column)
|
||||
{
|
||||
if (column.DataType != null && this.Context.CurrentConnectionConfig?.MoreSettings?.SqlServerCodeFirstNvarchar == true)
|
||||
{
|
||||
if (!column.DataType.ToLower().Contains("nvarchar"))
|
||||
{
|
||||
column.DataType = column.DataType.ToLower().Replace("varchar", "nvarchar");
|
||||
}
|
||||
}
|
||||
return base.UpdateColumn(tableName, column);
|
||||
}
|
||||
public override bool IsAnyTable(string tableName, bool isCache = true)
|
||||
{
|
||||
if (tableName.Contains("."))
|
||||
@ -536,6 +547,14 @@ namespace SqlSugar
|
||||
item.DecimalDigits = 4;
|
||||
item.Length = 18;
|
||||
}
|
||||
else if (item.DataType != null && this.Context.CurrentConnectionConfig?.MoreSettings?.SqlServerCodeFirstNvarchar == true)
|
||||
{
|
||||
if (!item.DataType.ToLower().Contains("nvarchar"))
|
||||
{
|
||||
item.DataType = item.DataType.ToLower().Replace("varchar", "nvarchar");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
string sql = GetCreateTableSql(tableName, columns);
|
||||
this.Context.Ado.ExecuteCommand(sql);
|
||||
|
@ -17,13 +17,6 @@ namespace SqlSugar
|
||||
{
|
||||
public class UtilMethods
|
||||
{
|
||||
public static string ToUnderLineNew(string str)
|
||||
{
|
||||
if(!str.Contains("_"))
|
||||
return string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString()));
|
||||
else
|
||||
return str;
|
||||
}
|
||||
public static string ToUnderLine(string str, bool isToUpper = false)
|
||||
{
|
||||
if (isToUpper)
|
||||
@ -181,8 +174,9 @@ namespace SqlSugar
|
||||
TableEnumIsString = it.MoreSettings.TableEnumIsString,
|
||||
DisableMillisecond = it.MoreSettings.DisableMillisecond,
|
||||
DbMinDate=it.MoreSettings.DbMinDate,
|
||||
IsNoReadXmlDescription=it.MoreSettings.IsNoReadXmlDescription
|
||||
|
||||
IsNoReadXmlDescription=it.MoreSettings.IsNoReadXmlDescription,
|
||||
SqlServerCodeFirstNvarchar=it.MoreSettings.SqlServerCodeFirstNvarchar
|
||||
|
||||
},
|
||||
SqlMiddle = it.SqlMiddle == null ? null : new SqlMiddle
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user