var context = ((IInfrastructure<IServiceProvider>)set).GetService<DbContext>();

在EF Core 1.0 中会出现如下错误

Unhandled Exception: System.InvalidOperationException: No database provider has been configured for this DbContext. A provider can be configured by overriding the DbContext.OnConfiguring method or by using AddDbContext on the application service provider. If AddDbContext is used, then also ensure that your DbContext type accepts a DbContextOptions<TContext> object in its constructor and passes it to the base constructor for DbContext.

解决方案:

var context = ((IInfrastructure<IServiceProvider>)set).GetService<ICurrentDbContext>().Context;

最新文章

  1. 可爱的Python_课后习题_CDay−5 Python 初体验和原始需求
  2. 【网络流24题----03】Air Raid最小路径覆盖
  3. linux概念之IPC
  4. insert into (select...WITH CHECK OPTION) values(...)
  5. oracle简单两个操作
  6. 观察者模式在ng(Angular)中的应用
  7. python django 自定义 装饰器
  8. Windows Phone开发(35):使用Express Blend绘图
  9. jquery+html三级联动下拉框及详情页面加载时的select初始化问题
  10. 第二章 Idea搭建maven
  11. Git安装教程(windows)
  12. ADT打开layout目录的xml报错java.lang.NullPointerException
  13. 如何用jQuery获取选中行固定列的数据
  14. .NET手记-Autofac进阶(属性和方法注入 Property and Method Injection)
  15. 深入浅出的webpack构建工具---AutoDllPlugin插件(八)
  16. Centos 7上安装Elasticsearch
  17. StreamSets学习系列之StreamSets的Core Tarball方式安装(图文详解)
  18. oracle查询指定月份数据
  19. linux下pcf8563驱动时钟使用
  20. Kubernetes PV/PVC使用实践

热门文章

  1. xpath 轴定位表达方式
  2. 区间dp括号匹配
  3. vue不同序号的元素添加不同的样式
  4. 解析PHP的self关键字
  5. cmder的segmentation fault错误修复
  6. 21.Merge Two Sorted Lists 、23. Merge k Sorted Lists
  7. 微信自定义分享 IOS端分享失败
  8. 阶段5 3.微服务项目【学成在线】_day04 页面静态化_17-页面静态化-模板管理-GridFS研究-存文件
  9. nginx反向代理本地 单台wed -使用域名代理
  10. 在本地环境(mac)启用https