Incorrect behavior of EntityHistory mechanism in exception event
Author: OmitalCreated May 22, 2025Updated Apr 28, 2026
Labelseffort-sm
Why is the change log in the entityHistory table still stored despite an exception being thrown in the backgroundJob or worker? Is this mechanism correct?
suppose this worker
` [UnitOfWork] public override async Task Execute(IJobExecutionContext context) {
using (AbpSession.Use(1, 2))
{
BaseData bd = new BaseData()
{
Name = Clock.Now.Ticks.ToString()
};
await _baseDataRepo.InsertAsync(bd);
await CurrentUnitOfWork.SaveChangesAsync();
throw new AbpException();
}
}`
After running this worker, result:
Source: aspnetboilerplate/aspnetboilerplate