You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

26 lines
760 B

using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading.Tasks;
using Wood.Data.Repository;
using Wood.Entity;
using Wood.Entity.SystemManage;
using Wood.EventBus;
using Wood.EventBus.Events;
using Wood.Util;
namespace Wood.Service.Events
{
public class LogOperationEventHandler : IntegrationEventHandler<LogOperationEvent>, ISingleton
{
/// <summary>
/// 保存日志
/// </summary>
/// <param name="event"></param>
/// <param name="scope"></param>
/// <returns></returns>
public override async Task Run(LogOperationEvent @event, IServiceScope scope)
{
await scope.ServiceProvider.GetRequiredService<SqlSugarRepository<LogOperationEntity>>().InsertAsync(@event.GetPayload<LogOperationEntity>()!);
}
}
}