abp icon indicating copy to clipboard operation
abp copied to clipboard

Calling multiple Async UOW first time at the same time

Open ugurozturk opened this issue 5 months ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description

When i try calling database requests at the same time for the first time, I am having error "This unit of work already contains a database API for the given key".

When i disable UOW, the problem doesn't occur.

https://github.com/abpframework/abp/blob/a226bd185826cdaf170e1fd4ae027c502ac9accd/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs#L196

Reproduction Steps

Task<List<TableA>> TableAList = GetIReadOnlyTableAList(); Task<List<TableB>> TableBList = GetIReadOnlyTableBList(); Task<List<TableC>> TableCList = GetIReadOnlyTableCList();

await Task.WhenAll(TableAList, TableBList, TableCList);

Expected behavior

Calling async tasks multiple times at the same time.

Actual behavior

Gives error because tries to add the same directory.

Regression?

No response

Known Workarounds

Let code bypass it rather than throwing.

Version

8.2.0

User Interface

MVC

Database Provider

EF Core (Default)

Tiered or separate authentication server

None (Default)

Operation System

Windows (Default)

Other information

No response

ugurozturk avatar Aug 28 '24 05:08 ugurozturk