Hi, is there a way to delete auditlogs by button? I try to get all elements in the table abpauditlogs var logs = _logRepository.GetAll().ToList(); foreach (var log in logs) { _logRepository.Delete(log.Id); _unitOfWorkManager.Current.SaveChanges(); }
But only logs that are pushed by myself to the table are deleted? What's the right way to delete the other entries?
1 Answer(s)
-
0
This approach gets significiant time. Instead, I suggest to directly run SQL (DELETE FROM AbpAuditLogs) in a custom repository (<a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/EntityFramework-Integration#DocCustomRepositoryMethods">http://www.aspnetboilerplate.com/Pages/ ... oryMethods</a>). Or you can use a library like that: <a class="postlink" href="https://github.com/loresoft/EntityFramework.Extended#batch-update-and-delete">https://github.com/loresoft/EntityFrame ... and-delete</a> it allows batch delete.