1, 安装sql server compact edition 4 sp1 Runtime
2, 安装sql server ce tool box for to Management or create local DB.
 
http://sqlcetoolbox.codeplex.com/
 
3, 以往的 Entity Framework 操作方式也不一樣了,先上 NuGet 取得 Entity Framework.SqlServerCompact
 
Code First with SQL CE  a sample project using Entity Framework 6 with code first. 
http://www.codeproject.com/Articles/680116/Code-First-with-SQL-CE
 
 
Entity Framework 6 & SQL Server Compact
http://dotnet.dzone.com/users/erikej
 
重要提示:配置文件中 configSections 要在  connectionStrings 节下面,不然会报错。
 1   <system.data>
 2     <DbProviderFactories>
 3       <remove invariant="System.Data.SqlServerCe.4.0" />
 4       <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
 5     </DbProviderFactories>
 6   </system.data>
 7   <connectionStrings>
 8     <add name="ProductContext" connectionString="Data Source=MyDB.sdf" providerName="System.Data.SqlServerCE.4.0"/>
 9     <!--<add name="sqliteContext"
10  connectionString="Data Source=E:\WHPCodeLiberary\temp\SqlLiteDBs\TestDB.s3db;Version=3;New=True;"
11  providerName="System.Data.SQLite"
12   />-->
13   </connectionStrings>
app.config for EF 5.0 -

相关文章:

  • 2021-09-10
  • 2021-09-04
  • 2021-07-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-16
  • 2021-10-12
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2021-04-27
相关资源
相似解决方案