Browse Source

Merge branch 'SqlSugar5' of github.com:donet5/SqlSugar

SqlSugar5
sunkaixuan 2 years ago
parent
commit
a32373d00f
  1. 14
      Src/Asp.Net/SqlSugar/Abstract/CodeFirstProvider/CodeFirstProvider.cs
  2. 14
      Src/Asp.NetCore2/SqlSugar/Abstract/CodeFirstProvider/CodeFirstProvider.cs

14
Src/Asp.Net/SqlSugar/Abstract/CodeFirstProvider/CodeFirstProvider.cs

@ -234,10 +234,18 @@ namespace SqlSugar
{
item.IndexName = (this.Context.CurrentConnectionConfig.IndexSuffix+ item.IndexName);
}
var database = "{db}";
if (item.IndexName!=null&&item.IndexName.Contains(database))
if (item.IndexName != null)
{
item.IndexName = item.IndexName.Replace(database, this.Context.Ado.Connection.Database);
var database = "{db}";
if (item.IndexName.Contains(database))
{
item.IndexName = item.IndexName.Replace(database, this.Context.Ado.Connection.Database);
}
var table = "{table}";
if (item.IndexName.Contains(table))
{
item.IndexName = item.IndexName.Replace(table, entityInfo.DbTableName);
}
}
if (!this.Context.DbMaintenance.IsAnyIndex(item.IndexName))
{

14
Src/Asp.NetCore2/SqlSugar/Abstract/CodeFirstProvider/CodeFirstProvider.cs

@ -234,10 +234,18 @@ namespace SqlSugar
{
item.IndexName = (this.Context.CurrentConnectionConfig.IndexSuffix+ item.IndexName);
}
var database = "{db}";
if (item.IndexName!=null&&item.IndexName.Contains(database))
if (item.IndexName != null)
{
item.IndexName = item.IndexName.Replace(database, this.Context.Ado.Connection.Database);
var database = "{db}";
if (item.IndexName.Contains(database))
{
item.IndexName = item.IndexName.Replace(database, this.Context.Ado.Connection.Database);
}
var table = "{table}";
if (item.IndexName.Contains(table))
{
item.IndexName = item.IndexName.Replace(table, entityInfo.DbTableName);
}
}
if (!this.Context.DbMaintenance.IsAnyIndex(item.IndexName))
{

Loading…
Cancel
Save