//using System;
//using System.Threading;
//using System.Threading.Tasks;
//using EntityFrameworkCore.Triggered;
//using IRaCIS.Core.Domain.Models;
//using IRaCIS.Core.Domain.Share;

//namespace IRaCIS.Core.Application.Triggers
//{
//    public class AuditUpdateTrigger : IBeforeSaveTrigger<IAuditUpdate>
//    {
//        private readonly IUserInfo _userInfo;

//        public AuditUpdateTrigger(IUserInfo userInfo)
//        {
//            _userInfo = userInfo;
//        }

//        public Task BeforeSave(ITriggerContext<IAuditUpdate> context, CancellationToken cancellationToken)
//        {
//            if (context.ChangeType == ChangeType.Modified || context.ChangeType == ChangeType.Added)
//            {
//                context.Entity.UpdateTime = DateTime.Now;

//                context.Entity.UpdateUserId = _userInfo.Id;

//            }

//            return Task.CompletedTask;

//        }
//    }
//}