mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-18 09:44:39 +08:00
Synchronization code
This commit is contained in:
@@ -109,6 +109,9 @@ namespace SqlSugar
|
||||
|
||||
#region Double
|
||||
case "float":
|
||||
result = "Convert.ToSingle";
|
||||
break;
|
||||
case "double":
|
||||
result = "Convert.ToDouble";
|
||||
break;
|
||||
#endregion
|
||||
|
@@ -452,7 +452,7 @@ namespace SqlSugar
|
||||
return item.DbColumnName;
|
||||
}
|
||||
}
|
||||
private string GetPropertyTypeName(DbColumnInfo item)
|
||||
protected virtual string GetPropertyTypeName(DbColumnInfo item)
|
||||
{
|
||||
string result = item.PropertyType != null ? item.PropertyType.Name : this.Context.Ado.DbBind.GetPropertyTypeName(item.DataType);
|
||||
if (result != "string" && result != "byte[]" && result != "object" && item.IsNullable)
|
||||
@@ -483,6 +483,30 @@ namespace SqlSugar
|
||||
{
|
||||
return "string";
|
||||
}
|
||||
if (item.DataType == "tinyint unsigned")
|
||||
{
|
||||
return "short";
|
||||
}
|
||||
if (item.DataType == "smallint unsigned")
|
||||
{
|
||||
return "ushort";
|
||||
}
|
||||
if (item.DataType == "bigint unsigned")
|
||||
{
|
||||
return "ulong";
|
||||
}
|
||||
if (item.DataType == "int unsigned")
|
||||
{
|
||||
return "uint";
|
||||
}
|
||||
if (item.DataType == "MediumInt")
|
||||
{
|
||||
return "int";
|
||||
}
|
||||
if (item.DataType == "MediumInt unsigned")
|
||||
{
|
||||
return "uint";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
private string GetPropertyTypeConvert(DbColumnInfo item)
|
||||
|
@@ -7,5 +7,29 @@ namespace SqlSugar
|
||||
{
|
||||
public class MySqlDbFirst : DbFirstProvider
|
||||
{
|
||||
protected override string GetPropertyTypeName(DbColumnInfo item)
|
||||
{
|
||||
if (item.DataType == "tinyint" && item.Length == 1&&this.Context.CurrentConnectionConfig.ConnectionString.ToLower().Contains("treattinyasboolea")==false)
|
||||
{
|
||||
item.DataType = "bit";
|
||||
item.DefaultValue = "true";
|
||||
return "bool";
|
||||
}
|
||||
if (item.DataType == "mediumint")
|
||||
{
|
||||
item.DataType = "int";
|
||||
return "int";
|
||||
}
|
||||
if (item.DataType == "mediumint unsigned")
|
||||
{
|
||||
item.DataType = "mediumint unsigned";
|
||||
return "uint";
|
||||
}
|
||||
if (item.DataType == "double unsigned")
|
||||
{
|
||||
return "double";
|
||||
}
|
||||
return base.GetPropertyTypeName(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user