You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
abp/test/Volo.Abp.MultiTenancy.Appli.../Volo/Abp/MultiTenancy/AbpMultiTenancyTestDataBuil...

34 lines
1003 B

using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Threading;
namespace Volo.Abp.MultiTenancy
{
public class AbpMultiTenancyTestDataBuilder : ITransientDependency
{
private readonly ITenantRepository _tenantRepository;
private readonly ITenantManager _tenantManager;
public AbpMultiTenancyTestDataBuilder(
ITenantRepository tenantRepository,
ITenantManager tenantManager)
{
_tenantRepository = tenantRepository;
_tenantManager = tenantManager;
}
public void Build()
{
AsyncHelper.RunSync(AddTenantsAsync);
}
private async Task AddTenantsAsync()
{
var acme = await _tenantManager.CreateAsync("acme");
await _tenantRepository.InsertAsync(acme);
var volosoft = await _tenantManager.CreateAsync("volosoft");
await _tenantRepository.InsertAsync(volosoft);
}
}
}