Base solution for your next web application
BLACK FRIDAY
From Nov 21
To Dec 1
XXDAYS : XXHRS : XXMIN : XXSEC
SAVE UP TO$3K
Also valid for the
existing customers!
Open Closed

Delete AbpAuditLogs #812


0
hans abelshausen created

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
    hikalkan created
    Support Team

    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.