Update SimpleClient.CopyNew()

This commit is contained in:
sunkaixuan
2023-12-21 16:08:43 +08:00
parent 4ba3ad6f4f
commit 72ed8467ea

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