Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

"The underlying provider failed on Open." #2997


User avatar
0
yrojas created

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.


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Can you get all records when you change your code to

    var entities= _repository.GetAllList();
    

    Thanks.

  • User Avatar
    0
    yrojas created

    Yes, I can.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    It might be related to commiting changes of 10.000 records at once. Do you know at which line do you get this error ?