Important 重要
The Audit Trail module is not supported by the Entity Framework ORM in the current version of XAF. If you are using EF, please skip this lesson and go to the next one.

当前版本的 XAF 中的实体框架 ORM 不支持审核跟踪模块。如果您使用的是 EF,请跳过本课程并转到下一课。

In this lesson, you will learn how to audit and analyze the changes that are made to business objects while running the application. For this purpose, the Audit Trail module will be added to the application. Changes made to the Contact object will be audited. Two techniques to analyze them will be used.

在本课中,您将学习如何审核和分析在运行应用程序时对业务对象所做的更改。为此,审核跟踪模块将添加到应用程序中。将审核对"联系人"对象所做的更改。将使用两种技术来分析它们。

Note 注意
Before proceeding, take a moment to review the Inherit from the Business Class Library Class (XPO) lesson.

在继续之前,请花点时间复习从商务舱库类 (XPO) 课程继承。

Audit Contact Objects

审核联系人对象

Add the AuditTrail module to your MySolution.Module project. For this purpose, find the Module.cs (Module.vb) file in the MySolution.Module project displayed in the Solution Explorer. Double-click this file to invoke the Module Designer. In the Toolbox, expand the DX.19.2: XAF Modules tab. Drag the AuditTrailModule item to the Designer's Required Modules section.

将审核跟踪模块添加到 MySolution.模块项目中。为此,在解决方案资源管理器中显示的 MySolution.模块项目中查找Module.cs(Module.vb)文件。双击此文件以调用模块设计器。在工具箱中,展开 DX.19.2:XAF 模块选项卡。将 AuditTrail 模块项目拖动到"设计器所需的模块"部分。

Now, all objects that are created in the application are audited. The Audit Trail System logs information on the change type (object was created, changed, etc.), who made this change, the object that was changed, the previous and new property values, etc. When an object is saved to the database, any changes between two sequential events are registered.

现在,将审核在应用程序中创建的所有对象。审核跟踪系统记录有关更改类型(对象已创建、更改等)、进行此更改的人员、已更改的对象、以前的属性值和新属性值等的信息。将对象保存到数据库时,将注册两个顺序事件之间的任何更改。

Analyze Audit Log in the Application

分析应用程序中的审核日志

Use the following approach to view object changes directly in the application.

使用以下方法直接在应用程序中查看对象更改。

  • Add a collection property to the Contact class. The collection's items will provide log information retrieved from the database.

  • 将集合属性添加到联系人类。集合项将提供从数据库中检索到的日志信息。

    [DefaultClassOptions]
    public class Contact : Person {
    //...
    private XPCollection<AuditDataItemPersistent> changeHistory;
    public XPCollection<AuditDataItemPersistent> ChangeHistory {
    get {
    if(changeHistory == null) {
    changeHistory = AuditedObjectWeakReference.GetAuditTrail(Session, this);
    }
    return changeHistory;
    }
    }
    }
  • Run the WinForms or ASP.NET application and invoke a Contact Detail View. Modify the Contact object to test the auditing capability, save the changes and click Refresh (). The Change History collection will contain information on the previous Contact object changes.

  • 运行 WinForms 或ASP.NET应用程序并调用联系人详细信息视图。修改"联系人"对象以测试审核功能,保存更改并单击"刷新(btn_refresh)。"更改历史记录"集合将包含有关以前的联系人对象更改的信息。

Note 注意
As you may remember, the Office property is declared in the Department class, not the Contact class. So, changes to the Office property made using the Contact Detail View are not displayed in the Contact's Change History. Instead, these changes appear in the corresponding Department object's Change History (if changes made to the Department objects are audited). You can acquire the audit log remotely using SQL queries to your database. See the Analyze the Audit Log topic.
您可能还记得,Office 属性在"部门"类中声明,而不是"联系人"类。因此,使用"联系人详细信息"视图对 Office 属性所做的更改不会显示在联系人的更改历史记录中。相反,这些更改将显示在相应的部门对象的更改历史记录中(如果对部门对象所做的更改被审核)。您可以使用对数据库的 SQL 查询远程获取审核日志。请参阅分析审核日志主题。

You can view the code demonstrated here in the Contact.cs (Contact.vb) file of the Main Demo installed with XAF. The MainDemo application is installed in %PUBLIC%\Documents\DevExpress Demos 19.2\Components\eXpressApp Framework\MainDemo by default. The ASP.NET version is available online at http://demos.devexpress.com/XAF/MainDemo/

您可以查看此处演示的带有 XAF 安装的主演示的 Contact.cs (Contact.vb) 文件中演示的代码。主演示应用程序安装在%PUBLIC%\Documents\DevExpress Demos 19.2\Components\eXpressApp Framework\MainDemo by default. The ASP.NET version is available online at http://demos.devexpress.com/XAF/MainDemo/

.

Audit Object Changes 审核对象更改的更多相关文章

  1. Role Object(角色对象)

    Role Object(角色对象) 索引 意图 结构 参与者 适用性 效果 相关模式 实现 实现方式(一):Role Object 的示例实现. 意图 通过明确地附加角色对象到目标对象中,以使对象可以 ...

  2. Vue:对象更改检测注意事项

    还是由于 JavaScript 的限制,Vue 不能检测对象属性的添加或删除: var vm = new Vue({ data: { a: 1 } }) // `vm.a` 现在是响应式的 vm.b ...

  3. DDD 领域驱动设计-Value Object(值对象)如何使用 EF 进行正确映射

    写在前面 首先,这篇博文是用博客园新发布的 MarkDown编辑器 编写的,这也是我第一次使用,语法也不是很熟悉,但我觉得应该会很爽,博文后面再记录下用过的感受,这边就不多说. 阅读目录: 上一篇回顾 ...

  4. PLSQL_Oracle Object所有数据库对象类型汇总和简解(概念)

    Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE /* Style Definitions */ table.MsoNormalTable ...

  5. Value Object(值对象)如何使用 EF 进行正确映射

    DDD 领域驱动设计-Value Object(值对象)如何使用 EF 进行正确映射 写在前面 首先,这篇博文是用博客园新发布的 MarkDown编辑器 编写的,这也是我第一次使用,语法也不是很熟悉, ...

  6. JSON(JavaScript Object Notation, JS 对象标记)

    JSON(JavaScript Object Notation, JS 对象标记) 是一种轻量级的数据交换格式.它基于 ECMAScript (w3c制定的js规范)的一个子集,采用完全独立于编程语言 ...

  7. 小程序的picker的range 是一个 Object Array (对象数组)

    小程序的picker的range 是一个 Object Array (对象数组) 数据: array: [{'id':1,'name':'Android'},{'id':2,'name':'IOS'} ...

  8. ngx-bootstrap使用03 Alerts组件、利用Object.assign复制对象

    1 Alerts 该组件用于给用户操作提供反馈信息或者提供一些警告信息 2 用法 2.1 下载ngx-bootstrap依赖 参考博文:点击前往 2.2 在模块级别导入AlertModule模块 技巧 ...

  9. 组件的通信 :provide / inject 对象进入后,就等于不用props,然后内部对象,直接复制可以接受数组,属性不能直接复制,可以用Object.assgin覆盖对象,或者Vue的set 双向绑定数据

    组件的通信 :provide / inject 对象进入后,就等于不用props,然后内部对象,直接复制可以接受数组,属性不能直接复制,可以用Object.assgin覆盖对象,或者Vue的set 双 ...

随机推荐

  1. css4——浮动

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  2. springcloud集成kafka

    项目名称:布控预警 水平拆分出来的项目,作为一个单独的可以对外提供服务的项目 项目设计:springcloud,可以集成各个不同平台的一个作为对外提供的微服务项目 项目功能:实现各个平台和本平台之间的 ...

  3. sbt assembly a fat jar for spark-submit cluster model

    在用spark-submit提交作业时,用sbt package打包好的jar程序,可以很好的运行在client模式,当在cluster模式, 一直报错:Exception in thread &qu ...

  4. 超详细实操教程!在现有K8S集群上安装JenkinsX,极速提升CI/CD体验!

    在2018年年初,Jenkins X首次发布,它由Apache Groovy语言的创建者Jame Strachan创建.Jenkins X 是一个高度集成化的 CI/CD 平台,基于 Jenkins ...

  5. Spring Cloud第五篇 | 服务熔断Hystrix

    ​ 本文是Spring Cloud专栏的第五篇文章,了解前四篇文章内容有助于更好的理解本文: Spring Cloud第一篇 | Spring Cloud前言及其常用组件介绍概览 Spring Clo ...

  6. Go语言学习之路

    我关于Go语言的博客原本发布于我的个人网站:wwww.liwenzhouu.com.但是被某些人抄怕了,没办法只好搬运到博客园. 我的Go语言学习之路 2015年底我因为工作原因接触到了Go语言,那时 ...

  7. python优势之通过一段代码来了解python的强大之处

    晚上闲暇之余随意翻了一下博客,看到https://www.jianshu.com/p/69bf0ed0b5cc作者提到了一段代码,刚开始看没啥感觉,仔细深入后引起了我的注意.里面使用了python最简 ...

  8. 2018HDU多校训练-3-Problem M. Walking Plan

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=6331 Walking Plan  Problem Description There are n inte ...

  9. 一文讲透Dubbo负载均衡之最小活跃数算法

    本文是对于Dubbo负载均衡策略之一的最小活跃数算法的详细分析.文中所示源码,没有特别标注的地方均为2.6.0版本. 为什么没有用截止目前的最新的版本号2.7.4.1呢?因为2.6.0这个版本里面有两 ...

  10. flash存储器原理及作用是什么?

    flash存储器的工作原理 flash存储器又称闪存(快闪存储器),是一种电可擦可编程只读存储器的形式,是可以在操作中被多次擦或写,EEPROM与高速RAM成为当前最常用且发展最快的两种存储技术.计算 ...