在我以前使用ASP.NET EF项目的经验中,我可以实例化ApplicationDbContext类而不传递任何参数,但是对于vNext,它似乎需要很多东西(IServiceProvider和IOptionsAccessorworkaround to create database until Entity Framework database migrations
// are supported in ASP.NET
要获得DI框架以将依赖项注入到Automapper自定义TypeConverter中,通常使用MapperConfiguration对象的ConstructServicesUsing方法。因此,使用ASP.NET核心DI,我希望能够像这样配置AutoMapper:
public static IMapperConfiguration Configure(IServiceProvider核心一起工作。但是,即使我将配置的这一部分推迟到配置方法(参见下面),依赖项仍然不会被注入</e