EF--model is being created异常
使用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最新版,最后函数使用同步就好了,暂时还没有弄明白这个问题到底如何解决
最新文章
- 【codevs1282】约瑟夫问题
- PHP DOS漏洞的新利用:CVE-2015-4024 Reviewed
- mac 安装nginx
- iOS 页面间几种传值方式(属性,代理,block,单例,通知)
- javaScript 相关笔记
- 优化SqlServer--数据压缩
- AngularJS学习--- AngularJS中数据双向绑定(two-way data-binding) orderBy step4
- 【读书笔记】iOS网络-HTTP-请求内容
- Http状态总结
- 深入浅出Android动态载入jar包技术
- Python数据类型(元组、列表、字符串、字典)
- 使用duilib开发简单的Window安装包
- JAVA程序设计的第一次作业
- js获取当前城市名
- java高级---->;Java观察者的原理
- Redis出现的问题
- SSM框架中的前后端分离
- SIP协议流程
- Hadoop+Hbas完全分布式安装部署
- 作业 20181204-4 互评Final版本