Doka.NestedSet 10.4.0

dotnet add package Doka.NestedSet --version 10.4.0
                    
NuGet\Install-Package Doka.NestedSet -Version 10.4.0
                    
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="Doka.NestedSet" Version="10.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Doka.NestedSet" Version="10.4.0" />
                    
Directory.Packages.props
<PackageReference Include="Doka.NestedSet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Doka.NestedSet --version 10.4.0
                    
#r "nuget: Doka.NestedSet, 10.4.0"
                    
#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.
#:package Doka.NestedSet@10.4.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Doka.NestedSet&version=10.4.0
                    
Install as a Cake Addin
#tool nuget:?package=Doka.NestedSet&version=10.4.0
                    
Install as a Cake Tool

Doka.NestedSet

ORM-independent nested-set bounds, node contracts, and in-memory ancestry predicates. This package has no Entity Framework Core or database-provider dependency.

Install

dotnet package add Doka.NestedSet --version 10.4.0

Version 10.4.0 retains the stable ORM-independent API from 10.0.0.

For database-backed hierarchies, install the matching Doka.EntityFrameworkCore.NestedSet.MySql, .Postgres, .Sqlite, or .SqlServer adapter instead. It brings in both common packages transitively. The getting-started guide covers EF mapping, native callback registration, queries, and mutations.

Validated bounds

using Doka.NestedSet;

var root = new NestedSetBounds(1, 6);
var child = new NestedSetBounds(2, 3);

var containsChild = root.Contains(child); // true
var rootWidth = root.Width; // 6
var descendantCount = root.DescendantCount; // 2 in a dense tree
var isLeaf = child.IsLeaf; // true

Bounds use positive long coordinates, require Right > Left, and require an even inclusive width. The default struct value is invalid; calculations and containment checks validate it. Contains is strict, so a node does not contain itself. Bounds alone do not carry a tree identity: callers must ensure that both intervals belong to the same tree. Local validation does not establish that an entire persisted tree is valid or dense.

Optional node contracts

INestedSetNode<TNodeKey, TTreeId> exposes Id, TreeId, Left, Right, Depth, and Position as getters. Roots have depth zero; sibling positions are zero-based. IScopedNestedSetNode<TNodeKey, TTreeId, TScope> also exposes Scope. The scoped tree identity is the pair (Scope, TreeId).

IsAncestorOf and IsDescendantOf compare complete tree identity before containment, using EqualityComparer<T>.Default for identity values. Use the scoped overload for scoped nodes; casting away the scope would discard part of their identity. These are strict, synchronous in-memory predicates, without database I/O. They validate the supplied bounds and reject null nodes.

EF mappings may use arbitrary entities without implementing either interface, including mapped shadow properties. Database writes, query translation, transactions, ordering, and structural repair belong to the EF packages.

The package is licensed under MIT.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Doka.NestedSet:

Package Downloads
Doka.EntityFrameworkCore.NestedSet

Nested-set hierarchy operations for Entity Framework Core.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.4.0 68 11/21/2026
10.3.0 163 11/6/2026
10.2.0 162 11/3/2026
10.1.0 162 10/30/2026
10.0.0 381 10/9/2026
10.0.0-rc.1 98 10/2/2026