AuditedDbContextConfigurator.Configure<TBusinessObjectDbContext, TAuditHistoryDbContext>(Action<XafApplication, DbContextOptionsBuilder>, Action<XafApplication, DbContextOptionsBuilder>, Action<AuditTrailOptions>) Method
Configures the main (business object) and additional (audit history) DbContext
objects in WinForms applications with the Audit Trail Module.
Namespace: DevExpress.ExpressApp.ApplicationBuilder
Assembly: DevExpress.ExpressApp.AuditTrail.EFCore.v24.1.dll
NuGet Package: DevExpress.ExpressApp.AuditTrail.EFCore
Declaration
public abstract void Configure<TBusinessObjectDbContext, TAuditHistoryDbContext>(
Action<XafApplication, DbContextOptionsBuilder> configureBusinessObjectDbContext,
Action<XafApplication, DbContextOptionsBuilder> configureAuditHistoryDbContext,
Action<AuditTrailOptions> configureAuditTrailOptions = null
)
where TBusinessObjectDbContext : DbContext where TAuditHistoryDbContext : DbContext
Parameters
Name | Type | Description |
---|---|---|
configureBusinessObjectDbContext | Action<XafApplication, DbContextOptionsBuilder> | A delegate that configures the main application |
configureAuditHistoryDbContext | Action<XafApplication, DbContextOptionsBuilder> | A delegate that configures the additional |
Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
configureAuditTrailOptions | Action<DevExpress.Persistent.BaseImpl.EFCore.AuditTrail.AuditTrailOptions> | null | Options that you can use to configure the Audit Trail Module. |
Type Parameters
Name | Description |
---|---|
TBusinessObjectDbContext | The main application |
TAuditHistoryDbContext | The additional |
Remarks
The following example demonstrates how to use this method:
File: MySolution.Blazor.Server\Startup.cs.
using DevExpress.ExpressApp.ApplicationBuilder;
using DevExpress.ExpressApp.Blazor.ApplicationBuilder;
// ...
public class Startup {
// ...
public void ConfigureServices(IServiceCollection services) {
// ...
services.AddXaf(Configuration, builder => {
builder.UseApplication<MySolutionBlazorApplication>();
builder.ObjectSpaceProviders
// ...
.AddSecuredEFCore()
.WithAuditedDbContext(contexts => {
contexts.Configure<MySolutionDbContext, AuditingDbContext>(
(serviceProvider, businessObjectDbContextOptions) => {
// ...
},
(serviceProvider, auditHistoryDbContextOptions) => {
// ...
},
options => {
// ...
});
});
});
// ...
}
}
File: MySolution.Win\Startup.cs.
using DevExpress.ExpressApp.ApplicationBuilder;
using DevExpress.ExpressApp.Win.ApplicationBuilder;
// ...
public class ApplicationBuilder : IDesignTimeApplicationFactory {
public static WinApplication BuildApplication(string connectionString) {
var builder = WinApplication.CreateBuilder();
builder.UseApplication<MySolutionWindowsFormsApplication>();
builder.ObjectSpaceProviders
.AddSecuredEFCore()
.WithAuditedDbContext(contexts => {
contexts.Configure<MySolutionDbContext, AuditingDbContext>(
(application, businessObjectDbContextOptions) => {
// ...
},
(application, auditHistoryDbContextOptions) => {
// ...
},
options => {
// ...
});
});
}
// ...
}