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"/>