Browse Source

Improve special case compatibility

pull/40/head
sunkaixuan 1 year ago
parent
commit
b2956b2bba
  1. 2
      Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve_Helper.cs
  2. 6
      Src/Asp.Net/SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs

2
Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve_Helper.cs

@ -711,7 +711,7 @@ namespace SqlSugar
return this.Context.DbMehtods.AggregateDistinctCount(model);
case "MappingColumn":
var mappingColumnResult = this.Context.DbMehtods.MappingColumn(model);
if (model.Args.Count == 1)
if (model.Args.Count == 1&& mappingColumnResult.IsNullOrEmpty())
{
return model.Args[0].MemberName.ObjToString().TrimStart('\'').TrimEnd('\'');
}

6
Src/Asp.Net/SqlSugar/Realization/SqlServer/DbMaintenance/SqlServerDbMaintenance.cs

@ -57,7 +57,7 @@ namespace SqlSugar
WHERE upper(xtype) IN('U',
'V') )
AND (systypes.name <> 'sysname')
AND sysobjects.name='{0}'
AND sysobjects.name=N'{0}'
AND systypes.name<>'geometry'
AND systypes.name<>'geography'
ORDER BY syscolumns.colid";
@ -371,7 +371,7 @@ namespace SqlSugar
}
else
{
var result= this.Context.Ado.GetInt($"select object_id('{tableName}')");
var result= this.Context.Ado.GetInt($"select object_id(N'{tableName}')");
return result > 0;
}
}
@ -386,7 +386,7 @@ namespace SqlSugar
tableName = SqlBuilder.GetNoTranslationColumnName(tableName);
}
var sql = @"IF EXISTS (SELECT * FROM sys.objects
WHERE type='u' AND name='"+tableName.ToSqlFilter()+@"')
WHERE type='u' AND name=N'"+tableName.ToSqlFilter()+@"')
SELECT 1 AS res ELSE SELECT 0 AS res;";
return this.Context.Ado.GetInt(sql) > 0;
}

Loading…
Cancel
Save