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.
34 lines
958 B
34 lines
958 B
3 years ago
|
using System.Threading.Tasks;
|
||
|
using Volo.Abp.Data;
|
||
|
using Volo.Abp.DependencyInjection;
|
||
|
using Volo.Abp.Guids;
|
||
|
using Volo.Abp.MultiTenancy;
|
||
|
|
||
|
namespace Win_in.Sfs.Scp.WebApi
|
||
|
{
|
||
|
public class WebApiDataSeedContributor : IDataSeedContributor, ITransientDependency
|
||
|
{
|
||
|
private readonly IGuidGenerator _guidGenerator;
|
||
|
private readonly ICurrentTenant _currentTenant;
|
||
|
|
||
|
public WebApiDataSeedContributor(
|
||
|
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;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|