审核日志删除的最佳方法是什么?

问题描述:

连接字符串上的用户标识不是变量,并且与程序的用户标识(例如,可以是GUID)不同.如果您的连接字符串的用户ID是静态的,您如何审核日志删除?

The user id on your connection string is not a variable and is different from the user id (can be GUID for example) of your program. How do you audit log deletes if your connection string's user id is static?

记录插入/更新/删除的最佳位置是通过触发器.但是使用静态连接字符串,很难记录谁删除了某些内容.有什么选择?

The best place to log insert/update/delete is through triggers. But with static connection string, it's hard to log who delete something. What's the alternative?

对于SQL Server,您可以使用CONTEXT_INFO将信息传递给触发器.

With SQL Server, you could use CONTEXT_INFO to pass info to the trigger.

我在必须使用触发器(例如,表上的多个写入路径)的代码中(由Web应用程序调用)使用此代码.这是无法将我的逻辑应用于存储过程的地方.

I use this in code (called by web apps) where I have to use triggers (eg multiple write paths on the table). This is where can't put my logic into the stored procedures.