Browse Source

Synchronization code

pull/30/head
sunkaixuan 2 years ago
parent
commit
7b2818aded
  1. 8
      Src/Asp.NetCore2/SqlSugar/Abstract/DbFirstProvider/DbFirstProvider.cs
  2. 4
      Src/Asp.NetCore2/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs
  3. 5
      Src/Asp.NetCore2/SqlSugar/Realization/Dm/DbBind/DmDbBind.cs
  4. 4
      Src/Asp.NetCore2/SqlSugar/Realization/Dm/DbMaintenance/DmDbMaintenance.cs
  5. 6
      Src/Asp.NetCore2/SqlSugar/Realization/Oracle/DbMaintenance/OracleDbMaintenance.cs

8
Src/Asp.NetCore2/SqlSugar/Abstract/DbFirstProvider/DbFirstProvider.cs

@ -272,6 +272,14 @@ namespace SqlSugar
string propertyTypeName = GetPropertyTypeName(item);
PropertyText =this.PropertyTextTemplateFunc == null? GetPropertyText(item, PropertyText):this.PropertyTextTemplateFunc(item,this.PropertyTemplate, propertyTypeName);
PropertyDescriptionText = GetPropertyDescriptionText(item, PropertyDescriptionText);
if (this.IsAttribute && item.DataType?.StartsWith("_") == true && PropertyText.Contains("[]"))
{
PropertyDescriptionText += "\r\n [SugarColumn(IsArray=true)]";
}
else if (item?.DataType?.StartsWith("json")==true)
{
PropertyDescriptionText += "\r\n [SugarColumn(IsJson=true)]";
}
PropertyText = PropertyDescriptionText + PropertyText;
classText = classText.Replace(DbFirstTemplate.KeyPropertyName, PropertyText + (isLast ? "" : ("\r\n" + DbFirstTemplate.KeyPropertyName)));
if (ConstructorText.HasValue() && item.DefaultValue != null)

4
Src/Asp.NetCore2/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs

@ -692,6 +692,10 @@ namespace SqlSugar
{
return result.Replace("/**/*", "");
}
if (this.IsSingle() && this.SubToListParameters != null&& expression is LambdaExpression && this.SubToListParameters.Count > 0 && this.TableShortName == null)
{
this.TableShortName =this.Builder.GetTranslationColumnName((expression as LambdaExpression).Parameters[0].Name);
}
if (result.Contains(".*") && this.IsSingle())
{
return "*";

5
Src/Asp.NetCore2/SqlSugar/Realization/Dm/DbBind/DmDbBind.cs

@ -43,6 +43,10 @@ namespace SqlSugar
{
return "other";
}
else if (dbTypeName == "sbyte")
{
return "byte";
}
else if (dbTypeName == "xml" || dbTypeName == "string")
{
return "string";
@ -97,6 +101,7 @@ namespace SqlSugar
new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.@double),
new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.@long),
new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.@bool),
new KeyValuePair<string, CSharpDataType>("boolean",CSharpDataType.@bool),
new KeyValuePair<string, CSharpDataType>("bit",CSharpDataType.@bool),
new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.@decimal),
new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.Single),

4
Src/Asp.NetCore2/SqlSugar/Realization/Dm/DbMaintenance/DmDbMaintenance.cs

@ -359,6 +359,10 @@ namespace SqlSugar
private List<DbColumnInfo> GetColumnInfosByTableName(string tableName)
{
string sql = "select * from " + SqlBuilder.GetTranslationTableName(tableName) + " WHERE 1=2 ";
if (!this.GetTableInfoList(false).Any(it => it.Name == SqlBuilder.GetTranslationTableName(tableName).TrimStart('\"').TrimEnd('\"')))
{
sql = "select * from \"" + tableName + "\" WHERE 1=2 ";
}
var oldIsEnableLog = this.Context.Ado.IsEnableLogEvent;
this.Context.Ado.IsEnableLogEvent = false;
using(DbDataReader reader = (DbDataReader) this.Context.Ado.GetDataReader(sql))

6
Src/Asp.NetCore2/SqlSugar/Realization/Oracle/DbMaintenance/OracleDbMaintenance.cs

@ -368,7 +368,11 @@ namespace SqlSugar
private List<DbColumnInfo> GetColumnInfosByTableName(string tableName)
{
List<DbColumnInfo> columns = GetOracleDbType(tableName);
string sql = "select * /* " + Guid.NewGuid() + " */ from " + SqlBuilder.GetTranslationTableName(tableName) + " WHERE 1=2 ";
string sql = "select * /* " + Guid.NewGuid() + " */ from " +SqlBuilder.GetTranslationTableName(tableName) + " WHERE 1=2 ";
if (!this.GetTableInfoList(false).Any(it => it.Name == SqlBuilder.GetTranslationTableName(tableName).TrimStart('\"').TrimEnd('\"')))
{
sql = "select * /* " + Guid.NewGuid() + " */ from \"" + tableName + "\" WHERE 1=2 ";
}
this.Context.Utilities.RemoveCache<List<DbColumnInfo>>("DbMaintenanceProvider.GetFieldComment."+tableName);
this.Context.Utilities.RemoveCache<List<string>>("DbMaintenanceProvider.GetPrimaryKeyByTableNames." + this.SqlBuilder.GetNoTranslationColumnName(tableName).ToLower());
var oldIsEnableLog = this.Context.Ado.IsEnableLogEvent;

Loading…
Cancel
Save