AuditedDbContextBuilderExtensions.WithAuditedDbContext<TContext>(DbContextServiceBasedBuilder<TContext>, Action<AuditedDbContextServiceBasedConfigurator>, ServiceLifetime) Method
Allows you to configure DbContext
objects in ASP.NET Core Blazor applications with the Audit Trail Module.
Namespace: DevExpress.ExpressApp.ApplicationBuilder
Assembly: DevExpress.ExpressApp.AuditTrail.EFCore.v24.2.dll
NuGet Package: DevExpress.ExpressApp.AuditTrail.EFCore
Declaration
public static IObjectSpaceProviderServiceBasedBuilder<TContext> WithAuditedDbContext<TContext>(
this DbContextServiceBasedBuilder<TContext> dbContextBuilder,
Action<AuditedDbContextServiceBasedConfigurator> configureContexts,
ServiceLifetime dbContextFactoryServiceLifetime = ServiceLifetime.Scoped
)
where TContext : IXafApplicationBuilder<TContext>, IAccessor<IServiceCollection>
Parameters
Name | Type | Description |
---|---|---|
dbContextBuilder | DbContextServiceBasedBuilder<TContext> | Allows you to configure |
configureContexts | Action<DevExpress.ExpressApp.ApplicationBuilder.AuditedDbContextServiceBasedConfigurator> | A delegate that configures |
Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
dbContextFactoryServiceLifetime | ServiceLifetime | Scoped | A ServiceLifetime enumeration value that specifies the lifetime of the |
Type Parameters
Name | Description |
---|---|
TContext | The IBlazorApplicationBuilder type. |
Returns
Type | Description |
---|---|
IObjectSpaceProviderServiceBasedBuilder<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.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 => {
// ...
});
});
});
// ...
}
}