AuditingStore.cs 955 B

1234567891011121314151617181920212223242526272829303132
  1. using System.Threading.Tasks;
  2. using Abp.Auditing;
  3. using Abp.Dependency;
  4. using Abp.Domain.Repositories;
  5. using IwbZero.BaseSysInfo;
  6. namespace IwbZero.Auditing
  7. {
  8. /// <summary>
  9. /// Implements <see cref="IAuditingStore"/> to save auditing informations to database.
  10. /// </summary>
  11. public class IwbAuditingStore : IAuditingStore, ITransientDependency
  12. {
  13. private readonly IRepository<IwbSysLog, long> _auditLogRepository;
  14. /// <summary>
  15. /// Creates a new <see cref="IwbAuditingStore"/>.
  16. /// </summary>
  17. public IwbAuditingStore(IRepository<IwbSysLog, long> auditLogRepository)
  18. {
  19. _auditLogRepository = auditLogRepository;
  20. }
  21. public virtual async Task SaveAsync(AuditInfo auditInfo)
  22. {
  23. var log =new IwbSysLog().CreateFromAuditInfo(auditInfo);
  24. if(log!=null)
  25. await _auditLogRepository.InsertAsync(log);
  26. }
  27. }
  28. }