/// <summary> /// 当 action 使用 <see cref="OperationTypeAttribute"/> 标记时,根据 <see cref="OperationTypeAttribute.OperationType"/> 的值创建一个 Op 对象并保存到数据库。 /// </summary> /// <param name="format">用于填充 <see cref="Op.Comment"/> 属性的格式化字符串。</param> /// <param name="args">用于填充 <see cref="Op.Comment"/> 属性的格式化参数。</param> /// <returns></returns> public async Task <Op> SaveOpAsync(string format, params object[] args) { Op op = new Op(); op.OperationType = GetOperationType(); op.Comment = string.Format(format, args); op.Url = _httpContextAccessor.HttpContext?.Request?.GetDisplayUrl(); await _session.SaveAsync(op); return(op); }