Entity Framework 4 & 4.1
Entity Framework 4.1 Code First学习之路(二)
QA1:
布署EF 4.1时遇到此问题:
未能加载文件或程序集“Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”或它的某一个依赖项。拒绝访问。
1.检查一下Web.Config中是否缺少
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
2.这时问题应该解决了一半,还会报一个错“用户 'IIS APPPOOL\ASP.NET v4.0' 登录失败。 ”
在iis管理器中——》应用程序池——》ASP.NET V4.0————》高级设置——》标识——》改为localSystem或者NetworkService。
3.如果还有问题,请参照“IIS APPPOOL\RwindRhine登录失败的解决方案”
QA2:
EF4.1 报错:Unable to load the specified metadata resource
是因为以下数据配置有问题
<add name="DecisionAuthContext" connectionString="metadata=res://*/DecisionAuthModel.DecisionAuth.csdl|res://*/DecisionAuthModel.DecisionAuth.ssdl|res://*/DecisionAuthModel.DecisionAuth.msl;provider=System.Data.SqlClient;provider connection string="data source=10.1.249.38;initial catalog=ProjectDecision;persist security info=True;user id=mqpan;password=123456;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
4.“Unable to update the EntitySet XXXXXX because it has a DefiningQuery and no element exists in the element to support the current operation.” is one of the errors you will eventually run into with the ADO.NET Entity Framework 1.0.
A Probable Cause
If a table doesn’t have a primary key defined, this error will occur when you’re trying to delete an object. The generated EDMX file should also generate a warning:
Warning 6002: The table/view ‘TABLENAME’ does not have a primary key defined. The key has been inferred and the definition was created as a read-only table/view.
A solution to this problem is simply adding a primary key to the table and update your EDMX model.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
2007-08-02 Sql 2005 盛宴系列