Doka.NestedSet
10.4.0
dotnet add package Doka.NestedSet --version 10.4.0
NuGet\Install-Package Doka.NestedSet -Version 10.4.0
<PackageReference Include="Doka.NestedSet" Version="10.4.0" />
<PackageVersion Include="Doka.NestedSet" Version="10.4.0" />
<PackageReference Include="Doka.NestedSet" />
paket add Doka.NestedSet --version 10.4.0
#r "nuget: Doka.NestedSet, 10.4.0"
#:package Doka.NestedSet@10.4.0
#addin nuget:?package=Doka.NestedSet&version=10.4.0
#tool nuget:?package=Doka.NestedSet&version=10.4.0
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 | Versions 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. |
-
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.