Created
April 3, 2019 11:24
-
-
Save ibrahimozgon/20e47c663a6ad83e510b3c1e2834a8da to your computer and use it in GitHub Desktop.
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 MyDbContext : DbContext | |
{ | |
private readonly ILoggerFactory _loggerFactory; | |
public MyDbContext(DbContextOptions<MyDbContext> options, ILoggerFactory loggerFactory) : base(options) | |
{ | |
_loggerFactory = loggerFactory; | |
} | |
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | |
{ | |
//1 | |
optionsBuilder.UseLoggerFactory(_loggerFactory); | |
base.OnConfiguring(optionsBuilder); | |
} | |
public DbSet<Product> Products { get; set; } | |
public DbSet<Category> Categories { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment