0
DominaTang created
With code below, at the second unit of work section, the line var dbData = repository.GetAsync(inserted.Id); throw exception, there is no Such Entity? Though if check database later, the new record is inserted into database successfully. Does Mongo driver cache the data somewhere?
[UnitOfWork(IsDisabled = true)]
public async Task SubmitAsync(XXXinput dto)
{
using var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true);
//Map dto to Domain entity
var inserted = await repository.InsertAysnc(domainEntity);
await uow.SaveChangesAsync();
await uow.CompleteAsync();
using var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true);
var dbData = repository.GetAsync(inserted.Id);
//Other db operation
await uow.SaveChangesAsync();
await uow.CompleteAsync();
}
- ABP Framework version: v7.2.3
- UI Type: Angular / MVC / Blazor WASM / Blazor Server
- Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..) / MongoDB
- Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
- Exception message and full stack trace:
- Steps to reproduce the issue:
3 Answer(s)
-
0
-
0
Inserted does return Id, line var dbData = repository.GetAsync(inserted.Id); throw exception, can not find entity with Id xxxxx in log, and that guid value is the Guid in MongoDb.
-
0
It looks like use .InsertAysnc(entity,true) resolved the problem.