+2 for implementation of when/how to audit in the DAL.
As for where the audit entries themselves should live, it depends on how it will be visible. I'd do a separate table if users can view a separate "audit trail report," but tag existing tables if you want to display last modified-type audits inline.
发布评论
评论(4)
我完全支持@IainMH(并投票给了他)。
您希望将其包含在 DAL 中,并且最好与某种切面/拦截器/代码注入机制相关联。
I totally second @IainMH (and voted him up).
You want to have it in your DAL and ideally tied to some kind of aspect/interceptor/code injection mechanism.
+2 用于实施何时/如何在 DAL 中进行审核。
至于审计条目本身应该存放在哪里,这取决于它的可见方式。 如果用户可以查看单独的“审核跟踪报告”,我会创建一个单独的表,但如果您想内联显示最后修改类型的审核,则标记现有表。
+2 for implementation of when/how to audit in the DAL.
As for where the audit entries themselves should live, it depends on how it will be visible. I'd do a separate table if users can view a separate "audit trail report," but tag existing tables if you want to display last modified-type audits inline.
这是我用来审计表的实现:
Pop Rivett 的 SQL Server 常见问题解答第 5 号:Pop 审计跟踪
Here is the implementation I use to audit tables:
Pop Rivett's SQL Server FAQ No.5: Pop on the Audit Trail
根据您正在执行的操作,您可能希望将审核从数据层移至数据访问层。 它给你更多的控制权。
我在这里问了关于 NHibernate 和 SqlServer 的类似问题。
Depending on what you're doing, you might want to move the audit out of the data layer into the data access layer. It give you more control.
I asked a similar question wrt NHibernate and SqlServer here.