You should just be able to specify the ProviderName in the connection string to your database.
<connectionStrings>
<add name="DataModelContext"
providerName="System.Data.SqlServerCe.4.0"
connectionString="Data Source=location\cfdb.sdf"/>
Question
How do I change my app.config or Migration Configuration.cs file so Entity Framework uses a local SDF file instead of a local SQL Server instance ? I am using EF 6.1.
Thanks
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework"type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
La solution
You should just be able to specify the ProviderName in the connection string to your database.
<connectionStrings>
<add name="DataModelContext"
providerName="System.Data.SqlServerCe.4.0"
connectionString="Data Source=location\cfdb.sdf"/>