ErikEJ.EntityFramework.SqlServerCompact 6.4.0-beta1

Prefix Reserved
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 and Polyglot Notebooks. 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"?>
<configuration>
    <packageSources>
        <add key="erikej" value="https://ci.appveyor.com/nuget/entityframework6-erikej" />
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    </packageSources>
</configuration>

Then add a PackageReference like this:

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

Provider Configuration

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

You can register the provider in code using an attribute:

[DbConfigurationType(typeof(SqlCeDbConfiguration))]
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"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <entityFramework>
    <providers>		
      <provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServer.SqlCeProviderServices, ErikEJ.EntityFramework.SqlServerCompact" />
    </providers>
  </entityFramework>
</configuration>

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);

Feedback

Please report any issues, questions and suggestions here

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
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-beta5 914 9/5/2023
6.4.0-beta4 265 4/6/2023
6.4.0-beta3 150 11/24/2022
6.4.0-beta2 273 10/10/2021
6.4.0-beta1 164 10/10/2021

Initial preview