[ASP.NET]学习日志-问题篇

来源:互联网 发布:unity3d 角色资源 编辑:程序博客网 时间:2024/06/06 07:07

1. 在ASP.NET中 Models > 数据模型类 经常会继承 DbContext 类 , 它不在默认引用类型中,需要通过NuGet程序包 加载 EntityFramework 后 方可使用 Using System.Data.Entity 命名空间后 继承 DbContext类


2. 再次运行会出现此类错误 No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.0'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

在Web.config中 添加

<provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices,EntityFramework.SqlServerCompact"/>

原创粉丝点击