ErikEJ.EntityFramework.SqlServer
6.4.1-preview1
Prefix Reserved
See the version list below for details.
Requires NuGet 5.0 or higher.
dotnet add package ErikEJ.EntityFramework.SqlServer --version 6.4.1-preview1
NuGet\Install-Package ErikEJ.EntityFramework.SqlServer -Version 6.4.1-preview1
<PackageReference Include="ErikEJ.EntityFramework.SqlServer" Version="6.4.1-preview1" />
paket add ErikEJ.EntityFramework.SqlServer --version 6.4.1-preview1
#r "nuget: ErikEJ.EntityFramework.SqlServer, 6.4.1-preview1"
// Install ErikEJ.EntityFramework.SqlServer as a Cake Addin #addin nuget:?package=ErikEJ.EntityFramework.SqlServer&version=6.4.1-preview1&prerelease // Install ErikEJ.EntityFramework.SqlServer as a Cake Tool #tool nuget:?package=ErikEJ.EntityFramework.SqlServer&version=6.4.1-preview1&prerelease
Entity Framework 6 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 various ways to configure Entity Framework to use this provider.
You can register the 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, add the DbConfigurationType attribute to all of them.
Or you can use the SetConfiguration method before any data access calls:
DbConfiguration.SetConfiguration(new 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:
<?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="Microsoft.Data.SqlClient" type="System.Data.Entity.SqlServer.MicrosoftSqlProviderServices, ErikEJ.EntityFramework.SqlServer" />
</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(MicrosoftSqlProviderServices.ProviderInvariantName, Microsoft.Data.SqlClient.SqlClientFactory.Instance);
If you use an EDMX file, update the Provider
name:
<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 (as needed).
using System.Data.SqlClient;
⇒ using Microsoft.Data.SqlClient;
SqlAzureExecutionStrategy
⇒ MicrosoftSqlAzureExecutionStrategy
SqlFunctions
⇒ MicrosoftSqlFunctions
Feedback
Please report any issues, questions and suggestions here
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.1
- EntityFramework (>= 6.4.0)
- Microsoft.Data.SqlClient (>= 2.1.4)
-
.NETStandard 2.1
- EntityFramework (>= 6.4.0)
- Microsoft.Data.SqlClient (>= 2.1.4)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on ErikEJ.EntityFramework.SqlServer:
Package | Downloads |
---|---|
SonicGD.EntityFramework.BulkExtensions
Bulk operations extension library for Entity Framework. |
|
CloudNimble.LinqPad.Drivers.EF6Core
A LINQPad 6+ driver for EF6 DbContexts using Microsoft.Data.SqlClient. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
6.6.11 | 21,784 | 6/1/2024 | |
6.6.10 | 2,530 | 5/22/2024 | |
6.6.9 | 132,036 | 1/30/2024 | |
6.6.8 | 3,312 | 1/19/2024 | |
6.6.7 | 4,715 | 1/10/2024 | |
6.6.6 | 77,205 | 8/6/2023 | |
6.6.6-preview2 | 257 | 8/3/2023 | |
6.6.6-preview1 | 864 | 8/3/2023 | |
6.6.5 | 152,344 | 4/4/2023 | |
6.6.4 | 42,191 | 2/9/2023 | |
6.6.3 | 33,531 | 1/20/2023 | |
6.6.2 | 77,416 | 11/24/2022 | |
6.6.0 | 46,423 | 9/8/2022 | |
6.6.0-rc1 | 236 | 9/5/2022 | |
6.5.0 | 6,465 | 9/4/2022 | |
6.5.0-rc1 | 418 | 8/9/2022 | |
6.4.3 | 105,739 | 3/24/2022 | |
6.4.2 | 901 | 3/12/2022 | |
6.4.1 | 123,967 | 12/12/2021 | |
6.4.1-preview1 | 274 | 11/27/2021 | |
6.4.0 | 116,380 | 8/24/2021 | |
1.0.0-rc5 | 761 | 8/19/2021 |
Updated SqlClient