添加了NLog日志,并且配置了写入数据库,修改了Notification通知不使用依赖注入,而是使用Message的方式

This commit is contained in:
2025-06-23 13:42:02 +08:00
parent 32648ff89f
commit c978b92fff
17 changed files with 291 additions and 69 deletions

View File

@@ -2,7 +2,7 @@
namespace PMSWPF.Data.Entities;
[SugarTable("Mqtt")]
public class DbMqtt
{
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]//数据库是自增才配自增

32
Data/Entities/DbNlog.cs Normal file
View File

@@ -0,0 +1,32 @@
using SqlSugar;
namespace PMSWPF.Data.Entities;
[SugarTable("nlog")]
public class DbNlog
{
// INSERT INTO [dbo].[NLog] (
// [Application], [Logged], [Level], [ThreadID],[Message],
// [Logger], [Callsite], [Exception], [Url], [Action], [User]
// ) VALUES (
// @Application, @Logged, @Level,@ThreadID, @Message,
// @Logger, @Callsite, @Exception, @Url, @Action, @User
// )
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]//数据库是自增才配自增
public int Id { get; set; }
public DateTime LogTime { get; set; }
public string Level { get; set; }
public int ThreadID { get; set; }
[SugarColumn(IsNullable = true)]
public string ThreadName { get; set; }
public string Logger { get; set; }
public string Callsite { get; set; }
public int CallsiteLineNumber { get; set; }
public string Message { get; set; }
[SugarColumn(IsNullable = true,ColumnDataType = "text")]
public string Exception { get; set; }
}