Synchronization code

This commit is contained in:
sunkaixuan 2023-12-21 16:10:34 +08:00
parent 72ed8467ea
commit 26205277b8

View File

@ -65,7 +65,14 @@ namespace SqlSugar
o = Activator.CreateInstance(type); o = Activator.CreateInstance(type);
} }
var result = (RepositoryType)o; var result = (RepositoryType)o;
result.Context = this.Context.CopyNew(); if (result.Context != null)
{
result.Context = result.Context.CopyNew();
}
else
{
result.Context = this.Context.CopyNew();
}
return result; return result;
} }
public RepositoryType ChangeRepository<RepositoryType>() where RepositoryType : ISugarRepository public RepositoryType ChangeRepository<RepositoryType>() where RepositoryType : ISugarRepository