synchronization

This commit is contained in:
sunkaixuan 2023-04-10 15:45:18 +08:00
parent 859d4cc78a
commit 7692ecf1fa

View File

@ -48,6 +48,17 @@ namespace SqlSugar
public virtual void InitTables(Type entityType)
{
var splitTableAttribute = entityType.GetCustomAttribute<SplitTableAttribute>();
if (splitTableAttribute != null)
{
var mappingInfo=this.Context.MappingTables.FirstOrDefault(it => it.EntityName == entityType.Name);
if (mappingInfo == null)
{
this.Context.CodeFirst.SplitTables().InitTables(entityType);
this.Context.MappingTables.RemoveAll(it=>it.EntityName==entityType.Name);
return;
}
}
//Prevent concurrent requests if used in your program
lock (CodeFirstProvider.LockObject)
{