Hi,
I have a scheduled background job to perform a long-running task, it basically works by reading all the records in a table and by each record writing a new record in another table, when are few records it works as expected but when are more than 10000 records throws this exception: "The underlying provider failed on Open."
This is part of my code:
public class MyBackgroundJob : JobBase, ITransientDependency
{
private readonly IRepository<MyEntity, long> _repository;
public MyBackgroundJob(IRepository<MyEntity, long> repository)
{
_repository = repository;
}
public override void Execute(IJobExecutionContext context)
{
using (var unitOfWork = UnitOfWorkManager.Begin())
{
using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.MayHaveTenant))
{
IQueryable<MyEntity> entities= _repository.GetAll();
foreach (MyEntity entity in entities)
{
.....
Any sugestion? Thanks in advance.
Hi there, Im using IRepository<OrganizationUnit, long> in a schedule background job with Quartz, but the getAll() method is returning empty, even when I have organization units in my database. The repository works fine inside managers and services.
This is part of my code:
public class MyBackgroundJob : JobBase, ITransientDependency
{
private readonly IRepository<OrganizationUnit, long> _organizationUnitRepository;
public MyBackgroundJob(IRepository<OrganizationUnit, long> organizationUnitRepository)
{
_organizationUnitRepository = organizationUnitRepository;
}
public override void Execute(IJobExecutionContext context)
{
using (var unitOfWork = UnitOfWorkManager.Begin())
{
IQueryable<OrganizationUnit> organizationUnits = _organizationUnitRepository.GetAll();
.....
At this point organizationUnits its allways empty.
What can I be missing here?
Thanks in advance.