mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-08 02:14:53 +08:00
Split table
This commit is contained in:
@@ -12,9 +12,8 @@ namespace SqlSugar
|
||||
public void InitTables<T>()
|
||||
{
|
||||
//var oldMapping = this.Context.Utilities.TranslateCopy(this.Context.MappingTables);
|
||||
SplitTableContext helper = new SplitTableContext()
|
||||
SplitTableContext helper = new SplitTableContext(Context)
|
||||
{
|
||||
Context = this.Context,
|
||||
EntityInfo = this.Context.EntityMaintenance.GetEntityInfo<T>()
|
||||
};
|
||||
helper.CheckPrimaryKey();
|
||||
|
||||
@@ -263,9 +263,8 @@ namespace SqlSugar
|
||||
this.Context.MappingTables.Add(this.EntityInfo.EntityName, this.EntityInfo.DbTableName);
|
||||
SplitTableDeleteProvider<T> result = new SplitTableDeleteProvider<T>();
|
||||
result.Context = this.Context;
|
||||
SplitTableContext helper = new SplitTableContext()
|
||||
SplitTableContext helper = new SplitTableContext((SqlSugarProvider)Context)
|
||||
{
|
||||
Context =(SqlSugarProvider)Context,
|
||||
EntityInfo = this.EntityInfo
|
||||
};
|
||||
var tables = getTableNamesFunc(helper.GetTables());
|
||||
|
||||
@@ -408,10 +408,9 @@ namespace SqlSugar
|
||||
}
|
||||
public SplitInsertable<T> SplitTable(SplitType splitType)
|
||||
{
|
||||
SplitTableContext helper = new SplitTableContext()
|
||||
SplitTableContext helper = new SplitTableContext(Context)
|
||||
{
|
||||
Context = this.Context,
|
||||
EntityInfo = this.Context.EntityMaintenance.GetEntityInfo<T>()
|
||||
EntityInfo = this.EntityInfo
|
||||
};
|
||||
helper.CheckPrimaryKey();
|
||||
SplitInsertable<T> result = new SplitInsertable<T>();
|
||||
|
||||
@@ -836,10 +836,9 @@ namespace SqlSugar
|
||||
}
|
||||
public ISugarQueryable<T> SplitTable(Func<List<SplitTableInfo>, IEnumerable<SplitTableInfo>> getTableNamesFunc)
|
||||
{
|
||||
SplitTableContext helper = new SplitTableContext()
|
||||
{
|
||||
Context=Context,
|
||||
EntityInfo=this.EntityInfo
|
||||
SplitTableContext helper = new SplitTableContext(Context)
|
||||
{
|
||||
EntityInfo = this.EntityInfo
|
||||
};
|
||||
this.Context.MappingTables.Add(this.EntityInfo.EntityName, this.EntityInfo.DbTableName);
|
||||
var tables = getTableNamesFunc(helper.GetTables());
|
||||
|
||||
@@ -94,9 +94,8 @@ namespace SqlSugar
|
||||
this.Context.MappingTables.Add(this.EntityInfo.EntityName, this.EntityInfo.DbTableName);
|
||||
SplitTableUpdateProvider<T> result = new SplitTableUpdateProvider<T>();
|
||||
result.Context = this.Context;
|
||||
SplitTableContext helper = new SplitTableContext()
|
||||
SplitTableContext helper = new SplitTableContext(Context)
|
||||
{
|
||||
Context = (SqlSugarProvider)Context,
|
||||
EntityInfo = this.EntityInfo
|
||||
};
|
||||
var tables = getTableNamesFunc(helper.GetTables());
|
||||
|
||||
@@ -12,8 +12,10 @@ namespace SqlSugar
|
||||
public SqlSugarProvider Context { get; set; }
|
||||
public EntityInfo EntityInfo { get; set; }
|
||||
public ISplitTableService Service { get; set; }
|
||||
public SplitTableContext()
|
||||
private SplitTableContext() { }
|
||||
public SplitTableContext(SqlSugarProvider context)
|
||||
{
|
||||
this.Context = context;
|
||||
if (this.Context.CurrentConnectionConfig.ConfigureExternalServices != null&&this.Context.CurrentConnectionConfig.ConfigureExternalServices.SplitTableService!=null)
|
||||
{
|
||||
Service = this.Context.CurrentConnectionConfig.ConfigureExternalServices.SplitTableService;
|
||||
|
||||
Reference in New Issue
Block a user