😎 优化事件总线数据库存储

This commit is contained in:
zuohuaijun 2024-08-20 20:46:49 +08:00
parent 85d02a8997
commit e38e533221

View File

@ -26,8 +26,8 @@ public class AppEventSubscriber : IEventSubscriber, ISingleton, IDisposable
[EventSubscribe(CommonConst.AddExLog)] [EventSubscribe(CommonConst.AddExLog)]
public async Task CreateExLog(EventHandlerExecutingContext context) public async Task CreateExLog(EventHandlerExecutingContext context)
{ {
var rep = _serviceScope.ServiceProvider.GetRequiredService<SqlSugarRepository<SysLogEx>>(); var db = _serviceScope.ServiceProvider.GetRequiredService<ISqlSugarClient>();
await rep.InsertAsync((SysLogEx)context.Source.Payload); await db.CopyNew().Insertable((SysLogEx)context.Source.Payload).ExecuteCommandAsync();
} }
/// <summary> /// <summary>