Ejemplo n.º 1
0
        /// <summary>
        /// 异步事件处理
        /// </summary>
        /// <param name="eventData">事件源数据</param>
        /// <param name="cancelToken">异步取消标识</param>
        /// <returns>是否成功</returns>
        public override Task HandleAsync(AuditEntityEventData eventData, CancellationToken cancelToken = default)
        {
            eventData.CheckNotNull("eventData");
            cancelToken.ThrowIfCancellationRequested();

            AuditOperationEntry operation = _scopedDictionary.AuditOperation;

            if (operation == null)
            {
                return(Task.FromResult(0));
            }
            foreach (AuditEntityEntry auditEntity in eventData.AuditEntities)
            {
                SetAddedId(auditEntity);
                operation.EntityEntries.Add(auditEntity);
            }
            return(Task.FromResult(0));
        }