Hello,
I have a Background job which runs a method containing this code snippet
using (var unitOfWork = _unitOfWorkManager.Begin())
{
using (_unitOfWorkManager.Current.SetTenantId(tenantID))
{
var m = _metadataRepository.GetAll().Where(
m => m.Met_charval2.Contains(ReceiptStatus.Draft))
.ToListAsync();
unitOfWork.Complete();
}
}
The error I get is this
System.InvalidOperationException: 'No database provider has been configured for this DbContext. A provider can be configured by overriding the 'DbContext.OnConfiguring' method or by using 'AddDbContext' on the application service provider. If 'AddDbContext' is used, then also ensure that your DbContext type accepts a DbContextOptions<TContext> object in its constructor and passes it to the base constructor for DbContext.'
Can you help to to properly configure the IRepository while using it from Background Jobs? (FYI: it works fine with the normal login flow)
1 Answer(s)
-
0
Hi @MellowoodMedical
Can I see your entire job class? This code snippet looks correct. Can I also know your ASP.NET Zero and ABP versions?