AuditedDbContextBuilderExtensions.WithAuditedDbContext<TContext>(DbContextBuilder<TContext>, Action<AuditedDbContextConfigurator>) Method
Allows you to configure 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.v23.1.dll
NuGet Package: DevExpress.ExpressApp.AuditTrail.EFCore
Declaration
Parameters
Name | Type | Description |
---|---|---|
dbContextBuilder | DbContextBuilder<TContext> | Allows you to configure |
configureContexts | Action<AuditedDbContextConfigurator> | A delegate that configures |
Type Parameters
Name | Description |
---|---|
TContext | The IWinApplicationBuilder type. |
Returns
Type | Description |
---|---|
IObjectSpaceProviderBuilder<TContext> | Allows you to register and configure Object Space Providers in your application, and chain further provider registrations. |
Remarks
The following example demonstrates how to use this method:
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 => {
// ...
});
});
}
// ...
}