1

Identity in .Net 6 using razor pages. I want to audit ASP.NET Identity entities using Audit.EntityFramework.Identity. But I don't see any document.

I changed my ApplicationDbContext.cs

public class ApplicationDbContext : AuditIdentityDbContext
{
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.AddInterceptors(new AuditSaveChangesInterceptor());
    }
}

I don't see anything write to my Event table.

  • Are you [configuring a Data Provider](https://github.com/thepirat000/Audit.NET#data-providers)? If not, the events are saved by default on the application directory as `.json` files. Also check [EF DataProvider docs](https://github.com/thepirat000/Audit.NET/blob/master/src/Audit.EntityFramework/README.md#entity-framework-data-provider) – thepirat000 Jun 14 '22 at 03:37

1 Answers1

0

I figure it out before I put:

Audit.EntityFramework.Configuration.Setup()
                .ForContext<SSAreaDbContext>(_ => _
                    .AuditEventType("EF:{context}"))
                .UseOptOut();

SSAreaDbContext not include ApplicationDbContext

Now:

Audit.EntityFramework.Configuration.Setup()
                .ForAnyContext(x => x.IncludeEntityObjects(true)
                .AuditEventType("{context}:{database}"))
                .UseOptOut();

Everything is working now.