学习009-09-06 Audit Trail: Log Data Changes Made via Web API Endpoints(审计跟踪:通过 Web API 端点进行的数据更改日志 )

Audit Trail: Log Data Changes Made via Web API Endpoints(审计跟踪:通过 Web API 端点进行的数据更改日志 )

You can use the following methods to enable the Audit Trail module in your applications.
您可以使用以下方法在应用程序中启用审核跟踪模块。

Note
This option of our Web API Service ships as part of the DevExpress Universal Subscription.
我们的Web API服务的此选项作为DevExpress通用订阅的一部分提供。

Enable the Module in the Solution Wizard(在解决方案向导中启用模块)

If you create your Backend Web API project with the help of the Solution Wizard, a dedicated wizard screen allows you to enable the Audit Trail module. For additional information, see Create a Standalone Web API Application.
如果您在解决方案向导的帮助下创建后端Web API项目,则专用向导屏幕允许您启用审核跟踪模块。有关其他信息,请参阅创建独立Web API应用程序。

Enable the EF Core Audit Module in an Existing App(在现有应用程序中启用EF Core审核模块)

The general information about the EF Core Audit Module, refer to the following article:
有关EF核心审核模块的一般信息,请参阅以下文章:

  • Audit Trail Module (EF Core)(审计跟踪模块(EF Core))

Standalone Web API Application(独立的Web API应用程序)

Install the DevExpress.ExpressApp.AuditTrail.EFCore NuGet package.
安装DevExpress. ExpressApp.AuditTrail.EFCore NuGet包。

Register the audited DBContext in Startup.cs.
在Startup. cs中注册经过审核的DBContext。

C# 
services.AddXafWebApi(builder => {
    builder.Modules
        .AddAuditTrailEFCore();

    builder.ConfigureOptions(options => {
        //...
    });

    builder.ObjectSpaceProviders
        .AddSecuredEFCore()
        .WithAuditedDbContext(contexts => contexts.Configure<AppDbContext, AuditingDbContext>(
            (serviceProvider, options) => {
                string connectionString = Configuration.GetConnectionString("ConnectionString");
                options.UseSqlServer(connectionString);
                options.UseChangeTrackingProxies();
                options.UseObjectSpaceLinkProxies();
            },
            (serviceProvider, options) => {
                string connectionString = Configuration.GetConnectionString("ConnectionString");
                options.UseSqlServer(connectionString);
                options.UseChangeTrackingProxies();
                options.UseObjectSpaceLinkProxies();
            }
            ))
        .AddNonPersistent();
}, Configuration);

XAF Blazor Application(XAF Blazor应用)

Install the DevExpress.ExpressApp.AuditTrail.EFCore NuGet package.
安装DevExpress. ExpressApp.AuditTrail.EFCore NuGet包。

Register the Audit Trail module and required services in Startup.cs. Use the XAF Application builder:
在Startup. cs中注册审核跟踪模块和所需的服务。使用XAF应用程序构建器:

C# 
services.AddXaf(Configuration, builder => {
    //..
    builder.Modules
        .AddAuditTrailEFCore()
    //...
}

Enable the XPO Audit Module in an Existing App(在现有应用程序中启用XPO审核模块)

For general information about XPO Audit Module, refer to the following article:
有关XPO审核模块的一般信息,请参阅以下文章:

  • Audit Trail Module (XPO)(审计跟踪模块(XPO))

Standalone Web API Application(独立的Web API应用程序)

Install the DevExpress.ExpressApp.AuditTrail.Xpo NuGet package.
安装DevExpress. ExpressApp.AuditTrail.Xpo NuGet包。

Register the Audit Trail module and required services via the Web API builder in Startup.cs:
通过Startup. cs中的Web API构建器注册审核跟踪模块和所需服务:

C# 
services.AddXafWebApi(builder => {
    builder.AddXpoServices();

    builder.Modules
        .AddAuditTrailXpo(options => {
            //...
        });
}, Configuration);

XAF Blazor Application(XAF Blazor应用)

Install the DevExpress.ExpressApp.AuditTrail.Xpo NuGet package.
安装DevExpress. ExpressApp.AuditTrail.Xpo NuGet包。

Register the Audit Trail module and required services via the XAF Application builder in Startup.cs:
通过Startup. cs中的XAF应用程序构建器注册审核跟踪模块和所需服务:

C# 
services.AddXaf(Configuration, builder => {
    //..
    builder.Modules
        .AddAuditTrailXpo(options => {
            //...
        })
    //...
}

Query and Analyze Audit Log Stored in a Data Store(查询和分析存储在数据存储中的审计日志)

After you run CRUD operations with the help of Web API endpoints, audit log will be stored in the underlying database (AuditDataItemPersistent table). The Audit Module tracks built-in change operations (such as object creation, deletion, property modification), as well as any custom operations.
在Web API端点的帮助下运行CRUD操作后,审计日志将存储在底层数据库(AuditDataItemPersistent表)中。审计模块跟踪内置的更改操作(如对象创建、删除、属性修改)以及任何自定义操作。

You can access the audit log with the help of any database management system (DBMS) that supports SQL query execution. Another option is to write code - use the API of your ORM tool:
您可以借助任何支持SQL查询执行的数据库管理系统(DBMS)访问审计日志。另一种选择是编写代码-使用ORM工具的API:
EF Core: Access the Audit Log In the Database(访问数据库中的审计日志)
XPO: Analyze the Audit Log using SQL Queries(使用SQL查询分析审核日志)

Web API Service users who own the Universal Subscription can optionally create an administrative XAF WinForms, Blazor, or ASP.NET WebForms clients to view and analyze the Audit Log:
拥有通用订阅的Web API服务用户可以选择创建管理XAF WinForms、Blazor或ASP.NETWebForms客户端来查看和分析审核日志:
EF Core: Display Change History in the Object Detail View(在对象详细信息视图中显示更改历史记录)
XPO: Analyze the Audit Log in a UI(分析UI中的审计日志)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

汤姆•猫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值