Update unit of work

This commit is contained in:
sunkaixuan
2023-07-05 22:15:30 +08:00
parent 83e626cd18
commit 6aaf9b6844

View File

@@ -83,8 +83,8 @@ namespace SqlSugar
public RepositoryType GetMyRepository<RepositoryType>() where RepositoryType:new()
{
var result = (ISugarRepository)new RepositoryType();
var type = typeof(RepositoryType).GetGenericArguments()[0];
TenantAttribute tenantAttribute = type.GetCustomAttribute<TenantAttribute>();
var type = typeof(RepositoryType).GetGenericArguments().FirstOrDefault();
TenantAttribute tenantAttribute = type?.GetCustomAttribute<TenantAttribute>();
if (tenantAttribute == null)
{
result.Context = this.Db;