ErikEJ.EntityFramework.SqlServer 1.0.0-rc5

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
.NET Standard 2.1 .NET Framework 4.6.1
This is a prerelease version of ErikEJ.EntityFramework.SqlServer.
There is a newer version of this package available.
See the version list below for details.

Requires NuGet 5.0 or higher.

dotnet add package ErikEJ.EntityFramework.SqlServer --version 1.0.0-rc5
NuGet\Install-Package ErikEJ.EntityFramework.SqlServer -Version 1.0.0-rc5
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.SqlServer" Version="1.0.0-rc5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ErikEJ.EntityFramework.SqlServer --version 1.0.0-rc5
#r "nuget: ErikEJ.EntityFramework.SqlServer, 1.0.0-rc5"
#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.SqlServer as a Cake Addin
#addin nuget:?package=ErikEJ.EntityFramework.SqlServer&version=1.0.0-rc5&prerelease

// Install ErikEJ.EntityFramework.SqlServer as a Cake Tool
#tool nuget:?package=ErikEJ.EntityFramework.SqlServer&version=1.0.0-rc5&prerelease

EF6 SQL Server provider based on Microsoft.Data.SqlClient

This Entity Framework 6 provider is a replacement provider for the built-in SQL Server provider. This provider depends on the modern Microsoft.Data.SqlClient ADO.NET provider, see my blog post here for why that can be desirable.

The latest build of this package is available from NuGet

Configuration

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

You can register teh provider in code using an attribute:

    [DbConfigurationType(typeof(MicrosoftSqlDbConfiguration))]
    public class SchoolContext : DbContext
    {
        public SchoolContext() : base()
        {
        }

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

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

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

 DbConfiguration.SetConfiguration(new System.Data.Entity.SqlServer.MicrosoftSqlDbConfiguration());

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

SetProviderFactory(MicrosoftSqlProviderServices.ProviderInvariantName, Microsoft.Data.SqlClient.SqlClientFactory.Instance);
SetProviderServices(MicrosoftSqlProviderServices.ProviderInvariantName, MicrosoftSqlProviderServices.Instance);
// Optional
SetExecutionStrategy(MicrosoftSqlProviderServices.ProviderInvariantName, () => new MicrosoftSqlAzureExecutionStrategy());

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

  <entityFramework>
    <providers>
      <provider invariantName="Microsoft.Data.SqlClient" type="System.Data.Entity.SqlServer.MicrosoftSqlProviderServices, ErikEJ.EntityFramework.SqlServer" />
    </providers>
  </entityFramework>

If you use an EDMX file, make sure to update the Provider name there:

<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
  <edmx:Runtime>
    <edmx:StorageModels>
      <Schema Namespace="ChinookModel.Store" Provider="Microsoft.Data.SqlClient" >

Code changes

In order to use the provider in an existing solution, a few code changes are required.

using System.Data.SqlClient;using Microsoft.Data.SqlClient;

SqlAzureExecutionStrategyMicrosoftSqlAzureExecutionStrategy

Feedback

Please report any issues and questions in the dedicated issue 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
.NET Core netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
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.6.3 758 1/20/2023
6.6.2 5,460 11/24/2022
6.6.0 6,638 9/8/2022
6.6.0-rc1 58 9/5/2022
6.5.0 632 9/4/2022
6.5.0-rc1 219 8/9/2022
6.4.3 35,722 3/24/2022
6.4.2 582 3/12/2022
6.4.1 56,874 12/12/2021
6.4.1-preview1 112 11/27/2021
6.4.0 46,216 8/24/2021
1.0.0-rc5 451 8/19/2021

Bug fixes