NooberCong.DynamicInclude 1.1.1

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

// Install NooberCong.DynamicInclude as a Cake Tool
#tool nuget:?package=NooberCong.DynamicInclude&version=1.1.1                

Extension method for dynamically including navigation properties in EF Core

Deep nested includes

Syntax:

// Single deep include
includePropName1.includePropName2

// Multiple child includes
includePropName1.(includePropName2, includePropName3)

Example:

context.Owners.DynamicInclude("Pets.(Snacks, Toys.Manufacturer)")

DynamicInclude is case-insensitive

// will also work
context.Owners.DynamicInclude("pets.(sNacks, tOys.manuFacturer)");

Normal EF Core equivalent:

context.Owners
	.Include(o => o.Pets)
		.ThenInclude(p => p.Snacks)
	.Include(o => o.Pets)
		.ThenInclude(p => p.Toys)
			.ThenInclude(t => t.Manufacturer)

Adding OrderBy to child includes

Syntax:

includePropname<[+-]orderPropName1, [+-]orderPropName2>

Example:

context.Owners.DynamicInclude("Pets<Name, -Weight>.Snacks<Id>")

Normal EF Core equivalent:

context.Owners
	.Include(o => o.Pets.OrderBy(p => p.Name).ThenByDescending(o => p.Weight))
		ThenInclude(p => p.Snacks.OrderBy(sn => sn.Id))

Skipping/Taking in child includes

Syntax:

// Take t elements
includePropName[:t]

// Skip s elements
includePropName[s:]

// Skip s and take (t - s) elements
includePropName[s:t]

Example:

context.Owners.DynamicInclude("Pets<-Weight>[:3].Snacks[1:4]")

Normal EF Core equivalent:

context.Owners
	.Include(o => o.Pets.OrderByDescending(p => p.Weights).Take(3))
		ThenInclude(p => p.Snacks.Skip(1).Take(3))

Note

If you experience performance issues, consider adding AsSplitQuery() to query

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
1.1.1 6,860 12/14/2021
1.1.0 288 12/14/2021
1.0.3 467 12/11/2021
1.0.2 305 12/11/2021
1.0.1 296 12/11/2021
1.0.0 296 12/11/2021