相关疑难解决方法(0)

如何在Asp.net Core rc1中的静态方法中使用DI

我看到ServiceProvder.GetService<ApplicationDbCotnext>()defaut 模板用于 初始化DbContext,但当你在静态方法中,我不知道如何获得DbContext,因为没有ServiceProvider.有办法搞定ServiceProvider吗?

dependency-injection asp.net-core

3
推荐指数
1
解决办法
8043
查看次数

标签 统计

asp.net-core ×1

dependency-injection ×1