使用EF的时候出现了下面的异常,我使用了TASK和saveChangeAsync()异步
The context cannot be used while the model is being created. This exception may be thrown if the context is used inside the OnModelCreating method or if the same context instance is accessed by multiple threads concurrently. Note that instance members of DbContext and related classes are not guaranteed to be thread safe.
微软论坛的解释
I have test your code, it can work well in my compter.

I have experienced this issue in the past and usually it was due not using the latest version + referencing issue.

Another reason for this error can be that while you create the context the first time and therefore cause the model to be created you create another context on a separate thread. You will have to wait for other context instances to be created after the model creation has completed.

但是我感觉应该不是EF版本的问题,我的是EF6.1.3最新版,最后函数使用同步就好了,暂时还没有弄明白这个问题到底如何解决

最新文章

  1. 【codevs1282】约瑟夫问题
  2. PHP DOS漏洞的新利用:CVE-2015-4024 Reviewed
  3. mac 安装nginx
  4. iOS 页面间几种传值方式(属性,代理,block,单例,通知)
  5. javaScript 相关笔记
  6. 优化SqlServer--数据压缩
  7. AngularJS学习--- AngularJS中数据双向绑定(two-way data-binding) orderBy step4
  8. 【读书笔记】iOS网络-HTTP-请求内容
  9. Http状态总结
  10. 深入浅出Android动态载入jar包技术
  11. Python数据类型(元组、列表、字符串、字典)
  12. 使用duilib开发简单的Window安装包
  13. JAVA程序设计的第一次作业
  14. js获取当前城市名
  15. java高级---->Java观察者的原理
  16. Redis出现的问题
  17. SSM框架中的前后端分离
  18. SIP协议流程
  19. Hadoop+Hbas完全分布式安装部署
  20. 作业 20181204-4 互评Final版本

热门文章

  1. $(document).ready 与 window.onload的区别?
  2. ckeditor详细设置
  3. codevs1993 草地排水(最大流)
  4. Java经典算法之选择排序(Select Sort)
  5. 不定长数组 Vector的 应用
  6. 未能加载文件或程序集Microsoft.SharePoint.Sandbox.dll
  7. unity多语言本地化
  8. Unity学习-预制(四)
  9. JavaScript入门笔记
  10. Android各种函数单位