Created
July 17, 2021 17:12
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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