Audit.NET icon indicating copy to clipboard operation
Audit.NET copied to clipboard

Log SQl Read (Select *) Results

Open chobo2 opened this issue 3 years ago • 0 comments

Describe the bug Right now the low level logging only logs the select statements EF makes such as

Select * From TableA

It does not record the actual results that come back from running this query.

To Reproduce Implement Low Level logging with EF and SQL Audit Extensions

Expected behavior All results form the select statements should also be logged.

Libraries (specify the Audit.NET extensions being used including version): For example:

  • Audit.EntityFramework: Current
  • Audit.NET.SqlServer: Current Target .NET framework:

For example:

  • .NET 5

chobo2 avatar Aug 08 '22 01:08 chobo2

Support for logging results for queries was added on version 19.2.2, please upgrade your references and re-test

For example:

public class MyContext : DbContext
{
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        // Add the low-level interceptor
        optionsBuilder.AddInterceptors(new AuditCommandInterceptor()
        {
            IncludeReaderResults = true
        });
    }
    // ...
}

thepirat000 avatar Aug 11 '22 23:08 thepirat000

Support for logging results for queries was added on version 19.2.2, please upgrade your references and re-test

For example:

public class MyContext : DbContext
{
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        // Add the low-level interceptor
        optionsBuilder.AddInterceptors(new AuditCommandInterceptor()
        {
            IncludeReaderResults = true
        });
    }
    // ...
}

Wow thanks for implementing this so fast. A quick look and it looks great. I will be reviewing it in more detail later with my team next week and will let you know.

Thanks

chobo2 avatar Aug 14 '22 03:08 chobo2