Impatient.EntityFrameworkCore.SqlServer 2.1.2

.NET Core 2.1
Install-Package Impatient.EntityFrameworkCore.SqlServer -Version 2.1.2
dotnet add package Impatient.EntityFrameworkCore.SqlServer --version 2.1.2
<PackageReference Include="Impatient.EntityFrameworkCore.SqlServer" Version="2.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Impatient.EntityFrameworkCore.SqlServer --version 2.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Impatient.EntityFrameworkCore.SqlServer, 2.1.2"
#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 Impatient.EntityFrameworkCore.SqlServer as a Cake Addin
#addin nuget:?package=Impatient.EntityFrameworkCore.SqlServer&version=2.1.2

// Install Impatient.EntityFrameworkCore.SqlServer as a Cake Tool
#tool nuget:?package=Impatient.EntityFrameworkCore.SqlServer&version=2.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Supports EF Core 2.1.0 with SQL Server 2016+.

After installing, configure your DbContext like this:

services.AddDbContext<NorthwindDbContext>(options =>
{
    options
        .UseSqlServer(connectionString)
        .UseImpatient();
});

Use Impatient with EF Core for SQL Server to get the most out of LINQ queries.

Impatient speaks JSON, so you can fetch dense result sets in one trip:

from e in employees
select new
{
    e.FirstName,
    e.LastName,
    RecentOrders = 
        (from o in e.Orders
         orderby o.OrderDate descending
         select o).Take(5).ToList(),
    TopCustomers = 
        (from o in e.Orders
         from d in o.OrderDetails
         group d by o.Customer into g
         let total = g.Sum(d => d.UnitPrice * d.Quantity * (decimal)(1 - d.Discount))
         orderby total descending
         select new
         {
             g.Key.ContactName,
             g.Key.CompanyName,
             total
         }).Take(5).ToList()
}
SELECT [e].[FirstName] AS [FirstName], [e].[LastName] AS [LastName], (
    SELECT TOP (5) [o].[OrderID] AS [OrderID], [o].[CustomerID] AS [CustomerID], [o].[EmployeeID] AS [EmployeeID], [o].[OrderDate] AS [OrderDate]
    FROM [Orders] AS [o]
    WHERE [o].[EmployeeID] = [e].[EmployeeID]
    ORDER BY [o].[OrderDate] DESC
    FOR JSON PATH
) AS [RecentOrders], (
    SELECT TOP (5) [c].[ContactName] AS [ContactName], [c].[CompanyName] AS [CompanyName], SUM(([o_0].[UnitPrice] * CAST([o_0].[Quantity] AS decimal(18, 2))) * CAST(1 - [o_0].[Discount] AS decimal(18, 2))) AS [total]
    FROM [Orders] AS [o_1]
    INNER JOIN [Order Details] AS [o_0] ON [o_1].[OrderID] = [o_0].[OrderID]
    LEFT JOIN (
        SELECT [c_0].[CustomerID] AS [CustomerID], [c_0].[Address] AS [Address], [c_0].[City] AS [City], [c_0].[CompanyName] AS [CompanyName], [c_0].[ContactName] AS [ContactName], [c_0].[ContactTitle] AS [ContactTitle], [c_0].[Country] AS [Country], [c_0].[Fax] AS [Fax], [c_0].[Phone] AS [Phone], [c_0].[PostalCode] AS [PostalCode], [c_0].[Region] AS [Region]
        FROM [Customers] AS [c_0]
    ) AS [c] ON [o_1].[CustomerID] = [c].[CustomerID]
    WHERE [o_1].[EmployeeID] = [e].[EmployeeID]
    GROUP BY [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
    ORDER BY SUM(([o_0].[UnitPrice] * CAST([o_0].[Quantity] AS decimal(18, 2))) * CAST(1 - [o_0].[Discount] AS decimal(18, 2))) DESC
    FOR JSON PATH
) AS [TopCustomers]
FROM [Employees] AS [e]

For more information, see the project site.

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
.NET Core netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
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
2.1.2 17,581 8/16/2018
2.1.1 1,669 6/14/2018
2.1.0 1,149 5/30/2018
2.1.0-rc1-final 605 5/18/2018
2.0.0 1,263 4/23/2018