mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-23 20:43:46 +08:00
Update SqlSugar.Access
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user