Update split table default length

This commit is contained in:
sunkaixuan 2024-02-03 13:56:53 +08:00
parent e375a73cbd
commit f5f72c1631
2 changed files with 7 additions and 3 deletions

View File

@ -30,6 +30,7 @@ namespace SqlSugar
{
var result = new SplitCodeFirstProvider();
result.Context = this.Context;
result.DefaultLength = this.DefultLength;
return result;
}

View File

@ -10,6 +10,9 @@ namespace SqlSugar
public class SplitCodeFirstProvider
{
public SqlSugarProvider Context;
public int DefaultLength { get; set; }
public void InitTables<T>()
{
var type = typeof(T);
@ -27,7 +30,7 @@ namespace SqlSugar
}
else
{
this.Context.CodeFirst.InitTables(type);
this.Context.CodeFirst.SetStringDefaultLength(this.DefaultLength).InitTables(type);
}
}
@ -46,13 +49,13 @@ namespace SqlSugar
foreach (var item in tables)
{
this.Context.MappingTables.Add(helper.EntityInfo.EntityName, item.TableName);
this.Context.CodeFirst.InitTables(type);
this.Context.CodeFirst.SetStringDefaultLength(this.DefaultLength).InitTables(type);
}
}
else
{
this.Context.MappingTables.Add(helper.EntityInfo.EntityName, helper.GetDefaultTableName());
this.Context.CodeFirst.InitTables(type);
this.Context.CodeFirst.SetStringDefaultLength(this.DefaultLength).InitTables(type);
}
this.Context.MappingTables.Add(helper.EntityInfo.EntityName, helper.EntityInfo.DbTableName);
}