Codefirst bug table name with database name

This commit is contained in:
skx 2020-10-01 14:11:40 +08:00
parent 3f9cec6dca
commit 7ad167dec3

View File

@ -7,5 +7,19 @@ namespace SqlSugar
{
public class SqlServerCodeFirst:CodeFirstProvider
{
protected override string GetTableName(EntityInfo entityInfo)
{
var table= this.Context.EntityMaintenance.GetTableName(entityInfo.EntityName);
var tableArray = table.Split('.');
var noFormat = table.Split(']').Length==1;
if (tableArray.Length > 2 && noFormat)
{
return tableArray.Last();
}
else
{
return table;
}
}
}
}