не может заручиться в транзакции, потому что локальная транзакция находится в прогрессе
на соединении. Завершите локальную транзакцию и повторно.
Код: Выделить всё
using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
{
// this first line itself is giving me the error even when I am just trying to select data here and
// have not even started saving anything to the database
IEnumerable formHierarchies = await _unitOfWork.FormHierarchyRepository.GetAllowedFormHierarchiesForADeclarationTypeAsync(model.DeclarationType);
// A lot of code for saving the entities follows this
}
< /code>
Это метод репозитория для выбора данных < /p>
public class FormHierarchyRepository : Repository, IFormHierarchyRepository
{
private readonly IDapperQueryManager _queryManager;
public readonly PJDbContext _dbContext;
public FormHierarchyRepository(IDapperQueryManager queryManager, PJDbContext dbContext) : base(dbContext)
{
_dbContext = dbContext;
_queryManager = queryManager;
}
public async Task GetAllowedFormHierarchiesForADeclarationTypeAsync(DeclarationTypes declarationType)
{
return await _dbContext.FormHierarchy.Where(x => x.DeclarationTypeId == (int)declarationType).ToListAsync();
}
}
Любая идея, что может пойти не так, и что я должен попробовать?
Подробнее здесь: https://stackoverflow.com/questions/795 ... gress-on-t