MVC3做审计跟踪 [英] MVC3 doing Audit trail

查看:180
本文介绍了MVC3做审计跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在桌子上做一个审计线索说客户表

I am doing an Audit trail on a table say Customer Table

Customer c1=new Customer(){name="customer1" ,job="IT",city="USA"};

说,如果我这样做对客户表的更新,我更新客户城市到加拿大

Say if i am doing an update on customer table and I am updating Customer City to CANADA

c1.city="CANADA";

所以我要做的就是审核本表中的一样,

So what i have to do is Audit this in a table like,


  • 1客户ID

  • CustomerID 1

字段名城市

美国OLDVALUE

oldvalue USA

NEWVALUE CANADA

Newvalue CANADA

等等.... whtever字段更新。

and so on.... whtever field is updated.

我的问题是,说我比字段多了,我怎样才能实现这个?

My Question is ,say I have more than Fields, How can I implement this?

如何比较老的记录与更新的记录要检查哪些字段CHANGED.HOW我能够拍摄这些更改的字段,并将其保存在审计表

How can I compare OLD RECORD WITH UPDATED RECORD TO CHECK WHICH FIELD IS CHANGED.HOW CAN I CAPTURE THOSE CHANGED FIELDS AND SAVE THEM IN AUDIT TABLE

推荐答案

我不会。这样每当更新是对有问题的表运行使用一个数据库触发器,更新前行的状态被捕获并放入审计表。

I wouldn't. Use a database trigger so that whenever an UPDATE is run on the table in question, the state of the row before the update is captured and put into an audit table.

这篇关于MVC3做审计跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆