ErikEJ.EntityFramework.SqlServerCompact 6.4.0-beta1

The ID prefix of this package has been reserved for one of the owners of this package by Prefix Reserved
.NET 5.0
This is a prerelease version of ErikEJ.EntityFramework.SqlServerCompact.
There is a newer prerelease version of this package available.
See the version list below for details.

Requires NuGet 5.0 or higher.

dotnet add package ErikEJ.EntityFramework.SqlServerCompact --version 6.4.0-beta1
NuGet\Install-Package ErikEJ.EntityFramework.SqlServerCompact -Version 6.4.0-beta1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ErikEJ.EntityFramework.SqlServerCompact" Version="6.4.0-beta1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ErikEJ.EntityFramework.SqlServerCompact --version 6.4.0-beta1
#r "nuget: ErikEJ.EntityFramework.SqlServerCompact, 6.4.0-beta1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install ErikEJ.EntityFramework.SqlServerCompact as a Cake Addin
#addin nuget:?package=ErikEJ.EntityFramework.SqlServerCompact&version=6.4.0-beta1&prerelease

// Install ErikEJ.EntityFramework.SqlServerCompact as a Cake Tool
#tool nuget:?package=ErikEJ.EntityFramework.SqlServerCompact&version=6.4.0-beta1&prerelease

Entity Framework 6 SQL Server Compact provider for .NET 5 (and later)

This Entity Framework provider includes everything required to start creating and using a SQL Server Compact embedded database with Entity Framework 6.

You can read more about using the SQL Server Compact ADO.NET provider with .NET Core in my blog post here

Getting started

Create a file called NuGet.config with the following contents in the same directory as your .NET solution or projects:

<?xml version="1.0" encoding="utf-8"?>
        <add key="erikej" value="" />
        <add key="" value="" />

Then add a PackageReference like this:

    <PackageReference Include="ErikEJ.EntityFramework.SqlServerCompact" Version="6.4.0-*" />

Provider Configuration

There are various ways to configure Entity Framework to use this provider.

You can register the provider in code using an attribute:

public class SchoolContext : DbContext
    public SchoolContext() : base()

    public DbSet<Student> Students { get; set; }

If you have multiple classes inheriting from DbContext in your solution, add the DbConfigurationType attribute to all of them.

Or you can use the SetConfiguration method before any data access calls:

 DbConfiguration.SetConfiguration(new SqlCeDbConfiguration());

Or you can add the following lines to your existing DbConfiguration class:

SetProviderFactory(SqlCeProviderServices.ProviderInvariantName, SqlServerCe.SqlCeProviderFactory.Instance);
SetProviderServices(SqlCeProviderServices.ProviderInvariantName, SqlCeProviderServices.Instance);

You can also use XML/App.Config based configuration:

<?xml version="1.0" encoding="utf-8"?>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
      <provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServer.SqlCeProviderServices, ErikEJ.EntityFramework.SqlServerCompact" />

If you use App.Config with a .NET Core / .NET 5 or later app, you must register the DbProviderFactory in code once:

DbProviderFactories.RegisterFactory(SqlCeProviderServices.ProviderInvariantName, SqlServerCe.SqlCeProviderFactory.Instance);


Please report any issues, questions and suggestions here

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
6.4.0-beta3 61 11/24/2022
6.4.0-beta2 186 10/10/2021
6.4.0-beta1 100 10/10/2021

Initial preview