How to inject DbContext instance in the ConfigureServices method of startup.cs correctly (ASP.net core 1.1)?
问题 I have implemented the EntityFrameworkFileProvider for my ASP.NET core web application, I want the ViewDbContext instance to be injected by ASP.NET core DI framework in the constructor: ( ViewDbContext is a dbContext ) public class EntityFrameworkFileProvider : IFileProvider { private ViewDbContext _context; public EntityFrameworkFileProvider(ViewDbContext context) { /* should be injected by asp.net core DI */ _context = context; } public IDirectoryContents GetDirectoryContents(string subpath