无法使用 ASP.Net 实体数据模型隐式转换类型

cannot implicitly convert type using ASP.Net Entity data model

我正在使用 ASP.Net 实体数据模型,见图片 (Model.edmx) 几天前它工作正常但我在图表中看到错误但是当我 运行 投影它工作很好,但是当重新构建解决方案时,我得到了错误,请参见第二张图片中的图片。如果

我改成如下

var content = contextObj.PersonalInfoes.Where(a => a.StudID == rolltemp).FirstOrDefault();

然后出现错误 我不明白为什么会出现此错误

提前致谢

看来你有一个 namespace conflict.To 避免那个错误,你必须在你的 class file.If 上使用正确的 namespace 那件事发生了突然之间,你可以在清洁 solution.Hope 之后再试一次,那东西也会解决你的问题。

实际出现问题是因为我将项目名称 StudentSys 更改为 StudentMgmSystem

 File Name : Model.edmx.diagram

修改如下问题解决后

   <EntityTypeShape EntityType="StudentMgmSystemModel.Login" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
    <EntityTypeShape EntityType="StudentMgmSystemModel.HostelDetail" Width="1.5" PointX="5.375" PointY="0.75" />
    <EntityTypeShape EntityType="StudentMgmSystemModel.PersonalInfo" Width="1.5" PointX="2.75" PointY="0.875" />

之前

 <EntityTypeShape EntityType="StudentSysModel.Login" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
    <EntityTypeShape EntityType="StudentSysModel.HostelDetail" Width="1.5" PointX="5.375" PointY="0.75" />
    <EntityTypeShape EntityType="StudentSysModel.PersonalInfo" Width="1.5" PointX="2.75" PointY="0.875" />