What is the difference between SqlServerCe
and SqlClient
code? Does EF code first require SqlServerCe
, or is it capable of SqlClient
also? What provider should I choose if I am operating on a local database?
My app.config
looks like this:
<entityFramework>
<defaultConnectionFactory
type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
<parameters>
<parameter value="System.Data.SqlServerCe.4.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient"
type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SqlServerCe.4.0"
type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />
<provider invariantName="System.Data.SQLite.EF6"
type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<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" />
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)"
invariant="System.Data.SQLite.EF6"
description=".NET Framework Data Provider for SQLite (Entity Framework 6)"
type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite" />
<add name="SQLite Data Provider"
invariant="System.Data.SQLite"
description=".NET Framework Data Provider for SQLite"
type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
I would like to get rid of SqlServerCe
or SqlClient
since I see no reason for both providers in my configuration.
Edit: what provider should I choose if I would focus on an Azure driven DB? (Does local or remote DB require a different provider)
SqlServerCe
is for the single-user, single-machine SQL Server Compact Edition, which is officially no longer supported by Microsoft.
SqlClient
is the provider for the full, complete SQL Server as we know it - also the basis for the Azure database offerings.
EF 6 supports both providers for sure.
If you want to remove anything - by all means remove SqlServerCe
and keep the real, full SQL Server around! But from a technical perspective, those are two very different database technologies, and there quite possibly might be situations where you need both