Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@manoj-choudhari-git
Created July 17, 2021 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manoj-choudhari-git/58d24d62fbc881ae3c53010c4704a6c0 to your computer and use it in GitHub Desktop.
Save manoj-choudhari-git/58d24d62fbc881ae3c53010c4704a6c0 to your computer and use it in GitHub Desktop.
.NET - A demo of DbCommandInterceptor using a simple EF Core DbContext
public class UniversityContext : DbContext
{
public UniversityContext(DbContextOptions<UniversityContext> options)
: base(options)
{
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
// ALERT - DEMO CODE
// You may want to inject the interceptors into the context
optionsBuilder.AddInterceptors(new DemoDbCommandInterceptor());
}
public DbSet<Student> Students { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment