ErikEJ.EntityFramework.SqlServerCompact 6.4.0-beta4

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-beta4                
NuGet\Install-Package ErikEJ.EntityFramework.SqlServerCompact -Version 6.4.0-beta4                
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-beta4" />                
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-beta4                
#r "nuget: ErikEJ.EntityFramework.SqlServerCompact, 6.4.0-beta4"                
#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-beta4&prerelease

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

Entity Framework 6 SQL Server Compact provider for .NET 6 (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

Add a PackageReference like this to use the latest preview build:

<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 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 net6.0 is compatible.  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 886 9/5/2023
6.4.0-beta4 261 4/6/2023
6.4.0-beta3 146 11/24/2022
6.4.0-beta2 269 10/10/2021
6.4.0-beta1 158 10/10/2021

Initial preview