0
nhontran created
- ABP Framework version: v3.3.2
- UI type: Angular
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): yes
- Exception message and stack trace:
- Steps to reproduce the issue:"
Hi, I am trying to understand the purpose of autoSave parameter in repository methods:
// Parameters:
// autoSave:
// Set true to automatically save changes to database. This is useful for ORMs /
// database APIs those only save changes with an explicit method call, but you need
// to immediately save changes to the database.
from the coding comment above, I expect every time I set the autoSave = true, the record will be inserted immediately into database without waiting for the scope of method to be completed (UOW), but it does not work as expected, the item is not inserted into database whether I set it to true or false.
I can solve the problem by calling _unitOfWorkManager.Current.SaveChangesAsync(), but anyone can explain what the autoSave prameter trying to do?
3 Answer(s)
-
0
hi
Can you share your code to reproduce?
autoSave
meandbContext.SaveChangesAsync
-
0
Hi @maliming,
Sorry for my late reply, I have shared the code to your email, please help us take a look.
var product = ObjectMapper.Map<ProductCreateDto, Product>(input); // create product 1 product = await _productRepository.InsertAsync(product, autoSave: true); // issue: product 1 was not created when I was debugging to this return line of code return ObjectMapper.Map<Product, ProductDto>(product);
-
0