EntityFramework使用SqlCe数据库

时间:2021-12-25 17:25:41

使用NuGet添加下面3个引用

 

EntityFramework使用SqlCe数据库

 

 

App.Config的<entityFramework>节点这样配置:

<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
<parameters>
<parameter value="System.Data.SqlServerCe.4.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>

这样就能使EF支持SQLCE了。