为PLinqO增加AuditLog 保存到数据库,这个是很简单就能实现了
1. 建一个日志表
CREATE TABLE [dbo].[AuditLog](
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[AuditLog] [xml] NOT NULL,
CONSTRAINT [PK_AuditLog] PRIMARY KEY CLUSTERED
(
[ID] ASC
)
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[AuditLog] [xml] NOT NULL,
CONSTRAINT [PK_AuditLog] PRIMARY KEY CLUSTERED
(
[ID] ASC
)
2.在生成的xxxDataContext.cs文件加一个方法
partial void AfterSubmitChanges()
{
this.ExecuteCommand("Insert into AuditLog values('" + this.LastAudit.ToXml() + "')");
}
{
this.ExecuteCommand("Insert into AuditLog values('" + this.LastAudit.ToXml() + "')");
}