Browse Source

Synchronization code

pull/31/head
sunkaixuan 2 years ago
parent
commit
80f9a07885
  1. 4
      Src/Asp.Net/SqlSugar/Realization/MySql/CodeFirst/MySqlCodeFirst.cs
  2. 2
      Src/Asp.Net/SqlSugar/Realization/MySql/DbBind/MySqlDbBind.cs

4
Src/Asp.Net/SqlSugar/Realization/MySql/CodeFirst/MySqlCodeFirst.cs

@ -92,6 +92,10 @@ namespace SqlSugar
{ {
result.DataType = this.Context.Ado.DbBind.GetDbTypeName(item.Length > 9 ? UtilConstants.LongType.Name : UtilConstants.IntType.Name); result.DataType = this.Context.Ado.DbBind.GetDbTypeName(item.Length > 9 ? UtilConstants.LongType.Name : UtilConstants.IntType.Name);
} }
else if (item.IsJson && item.DataType == null)
{
result.DataType = "json";
}
else else
{ {
var name = GetType(propertyType.Name); var name = GetType(propertyType.Name);

2
Src/Asp.Net/SqlSugar/Realization/MySql/DbBind/MySqlDbBind.cs

@ -25,7 +25,7 @@ namespace SqlSugar
if (csharpTypeName == "DateTimeOffset") if (csharpTypeName == "DateTimeOffset")
csharpTypeName = "DateTime"; csharpTypeName = "DateTime";
var mappings = this.MappingTypes.Where(it => it.Value.ToString().Equals(csharpTypeName, StringComparison.CurrentCultureIgnoreCase)); var mappings = this.MappingTypes.Where(it => it.Value.ToString().Equals(csharpTypeName, StringComparison.CurrentCultureIgnoreCase));
return mappings.HasValue() ? mappings.First().Key : "varchar"; return (mappings?.Any()==true) ? mappings.First().Key : "varchar";
} }
public override List<KeyValuePair<string, CSharpDataType>> MappingTypes public override List<KeyValuePair<string, CSharpDataType>> MappingTypes
{ {

Loading…
Cancel
Save