Hi team,
Just wondering if you could provide any guidance on when the SaveEntityAsync function might return a false value?
Obviously connection issues, database deadlock scenarios all throw an exception, but what are the common scenarios for a false value being returned and no exception being thrown?
The reason I ask is I have a piece of code I've tracked down where we are calling SaveEntityAsync and occasionally the entity simply does not save. The code in question doesn't test to see if the return result is true, it is really simple, similar to below.
using var adapter = new DataAccessAdapter() { CommandTimeOut = 600 };
await adapter.SaveEntityAsync(inventoryBinLocation);
This code is part of a some code that, probably obviously, processes inventory transactions and is part of a larger loop when processing multiple items. We're using auditing and we're not even getting an entry in the auditor when the save event isn't occurring. You can see our auditor entries and it's one inventory item in a loop missing one audit entry and all the other ones around it behave as expected.
I'd estimate that these inventoryBinLocations are being saved about 20k times a day and I think about once every 3 to 5 days it is occurring. There are other entities aside from the inventoryBinLocation as part of the larger function that are successfully saving either side of this one, and as mentioned no exception being raised.
I'm going to start testing the result of the SaveEntityAsync function and if it's false, attempt to log some additional information about it but to be honest I was curious what circumstance false would be returned. If that is indeed what is occurring.
I took at a brief look at the function and it appears to be linked to the rows updated by the queryController that executes the sql as part of the PersistQueueAsync function? I could keep diving down that rabbit hole but I thought you might be able to provide some quick guidance before I do.
I checked back over the documentation and can't see any guidance that we should be checking for a true return on SaveEntityAsync, or what state we're left in should it return false.
We're using MSSQL 2019 Enterprise and C# on .net 7, using LLBLGen Runtime with Adapter, all standard templates etc.. We do use Auditing but we don't use the LLBLGen Validation or much else that should influence behavior to my knowledge.