JiShe.CollectBus/test/JiShe.CollectBus.TestBase/CollectBusDataSeedContributor.cs
2024-12-19 16:07:07 +08:00

33 lines
875 B
C#

using System.Threading.Tasks;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.MultiTenancy;
namespace JiShe.CollectBus;
public class CollectBusDataSeedContributor : IDataSeedContributor, ITransientDependency
{
private readonly IGuidGenerator _guidGenerator;
private readonly ICurrentTenant _currentTenant;
public CollectBusDataSeedContributor(
IGuidGenerator guidGenerator, ICurrentTenant currentTenant)
{
_guidGenerator = guidGenerator;
_currentTenant = currentTenant;
}
public Task SeedAsync(DataSeedContext context)
{
/* Instead of returning the Task.CompletedTask, you can insert your test data
* at this point!
*/
using (_currentTenant.Change(context?.TenantId))
{
return Task.CompletedTask;
}
}
}