Browse Source

Optimized code

pull/30/head
sunkaixuan 2 years ago
parent
commit
7f02532635
  1. 5
      Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MemberInitExpressionResolve.cs
  2. 2
      Src/Asp.Net/SqlSugar/Realization/Sqlite/DbMaintenance/SqliteDbMaintenance.cs
  3. 5
      Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ResolveItems/MemberInitExpressionResolve.cs
  4. 2
      Src/Asp.NetCore2/SqlSugar/Realization/Sqlite/DbMaintenance/SqliteDbMaintenance.cs

5
Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MemberInitExpressionResolve.cs

@ -264,7 +264,10 @@ namespace SqlSugar
}
else
{
subSql = Regex.Replace(subSql, @" \[\w+?\]\.| ""\w+?""\.| \`\w+?\`\.", name + ".");
var p=(base.BaseParameter?.BaseParameter?.CurrentExpression as LambdaExpression)?.Parameters[0].Name;
subSql = subSql.Replace(this.Context.SqlTranslationLeft+p+this.Context.SqlTranslationRight+".",name + ".") ;
subSql = subSql.Replace(this.Context.SqlTranslationLeft + p.ToUpper() + this.Context.SqlTranslationRight + ".", name + ".");
subSql = subSql.Replace(this.Context.SqlTranslationLeft + p.ToLower() + this.Context.SqlTranslationRight + ".", name + ".");
}
}
parameter.Context.Result.Append(subSql);

2
Src/Asp.Net/SqlSugar/Realization/Sqlite/DbMaintenance/SqliteDbMaintenance.cs

@ -260,7 +260,7 @@ namespace SqlSugar
#region Methods
public override void AddDefaultValue(EntityInfo entityInfo)
{
Console.WriteLine("sqlite no support AddDefaultValue");
//sqlite no support AddDefaultValue
}
public override bool AddDefaultValue(string tableName, string columnName, string defaultValue)
{

5
Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ResolveItems/MemberInitExpressionResolve.cs

@ -264,7 +264,10 @@ namespace SqlSugar
}
else
{
subSql = Regex.Replace(subSql, @" \[\w+?\]\.| ""\w+?""\.| \`\w+?\`\.", name + ".");
var p=(base.BaseParameter?.BaseParameter?.CurrentExpression as LambdaExpression)?.Parameters[0].Name;
subSql = subSql.Replace(this.Context.SqlTranslationLeft+p+this.Context.SqlTranslationRight+".",name + ".") ;
subSql = subSql.Replace(this.Context.SqlTranslationLeft + p.ToUpper() + this.Context.SqlTranslationRight + ".", name + ".");
subSql = subSql.Replace(this.Context.SqlTranslationLeft + p.ToLower() + this.Context.SqlTranslationRight + ".", name + ".");
}
}
parameter.Context.Result.Append(subSql);

2
Src/Asp.NetCore2/SqlSugar/Realization/Sqlite/DbMaintenance/SqliteDbMaintenance.cs

@ -257,7 +257,7 @@ namespace SqlSugar
#region Methods
public override void AddDefaultValue(EntityInfo entityInfo)
{
Console.WriteLine("sqlite no support AddDefaultValue");
//sqlite no support AddDefaultValue
}
public override bool AddDefaultValue(string tableName, string columnName, string defaultValue)
{

Loading…
Cancel
Save