mirror of https://github.com/abpframework/abp.git
committed by
GitHub
6 changed files with 100 additions and 15 deletions
@ -1,16 +1,22 @@ |
|||
namespace Volo.Abp.BackgroundJobs; |
|||
using System; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
public class MyAsyncJobArgs |
|||
namespace Volo.Abp.BackgroundJobs; |
|||
|
|||
public class MyAsyncJobArgs: IMultiTenant |
|||
{ |
|||
public string Value { get; set; } |
|||
|
|||
public Guid? TenantId { get; } |
|||
|
|||
public MyAsyncJobArgs() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public MyAsyncJobArgs(string value) |
|||
public MyAsyncJobArgs(string value, Guid? tenantId = null) |
|||
{ |
|||
Value = value; |
|||
TenantId = tenantId; |
|||
} |
|||
} |
|||
|
|||
@ -1,14 +1,26 @@ |
|||
using System.Collections.Generic; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace Volo.Abp.BackgroundJobs; |
|||
|
|||
public class MyJob : BackgroundJob<MyJobArgs>, ISingletonDependency |
|||
{ |
|||
public List<string> ExecutedValues { get; } = new List<string>(); |
|||
|
|||
public Guid? TenantId { get; set; } |
|||
|
|||
private readonly ICurrentTenant _currentTenant; |
|||
|
|||
public MyJob(ICurrentTenant currentTenant) |
|||
{ |
|||
_currentTenant = currentTenant; |
|||
} |
|||
|
|||
public override void Execute(MyJobArgs args) |
|||
{ |
|||
ExecutedValues.Add(args.Value); |
|||
TenantId = _currentTenant.Id; |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue