Update SqlSugar.Access

This commit is contained in:
sunkaixuan
2022-02-20 13:54:58 +08:00
parent 44a908097f
commit b43f668290
21 changed files with 2270 additions and 2 deletions

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SqlSugar.Access
{
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 > 1 && noFormat)
{
var dbMain = new SqlServerDbMaintenance() { Context = this.Context };
var schmes = dbMain.GetSchemas();
if (!schmes.Any(it => it.EqualCase(tableArray.First())))
{
return tableArray.Last();
}
else
{
return dbMain.SqlBuilder.GetTranslationTableName(table);
}
}
else
{
return table;
}
}
}
}