We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IServiceScopeFactory
PeriodicBackgroundWorkerBase
PeriodicBackgroundWorkerContext
DoWork
The text was updated successfully, but these errors were encountered:
Resolved #2540. Resolved #2539.
401376e
* Send IServiceProvider to DoWork method of the periodic background worker #2539 * Introduce AsyncPeriodicBackgroundWorkerBase #2540
@hikalkan
Any sample code on how to use this, before 2.o my code was working, but now it's not.
Added IServiceScopeFactory to the PeriodicBackgroundWorkerBase constructor. Added PeriodicBackgroundWorkerContext to the DoWork method.
Sorry, something went wrong.
@hikalkan How should i use the workerContext and the scope factory ?
Below is my code
public class BankingSwitchSync : PeriodicBackgroundWorkerBase, ISingletonDependency { private readonly IBackgroundJobManager _backgroundJobManager; private readonly ICurrentUser _currentUser; private readonly ICurrentTenant _currentTenant; public BankingSwitchSync(AbpTimer timer, IServiceScopeFactory serviceScopeFactory, IBackgroundJobManager backgroundJobManager, ICurrentTenant currentTenant, ICurrentUser currentUser ) : base(timer,serviceScopeFactory) { _backgroundJobManager = backgroundJobManager; _currentTenant = currentTenant; _currentUser = currentUser; timer.Period = 6000; } protected override void DoWork(PeriodicBackgroundWorkerContext workerContext) { this.Logger.LogDebug("Banking Switch Sync => Do Work.."); string user = ""; string tenant = ""; user = _currentUser.UserName; tenant = _currentTenant.Name; string settings1 = ""; } }
@dicksonkimeu Sample code on how to use workerContext:
workerContext
abp/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs
Line 35 in 401376e
You should not need to use IServiceScopeFactory directly.
hikalkan
Successfully merging a pull request may close this issue.
IServiceScopeFactory
to thePeriodicBackgroundWorkerBase
constructor.PeriodicBackgroundWorkerContext
to theDoWork
method.The text was updated successfully, but these errors were encountered: