PhotoAtomic.Clooney
0.6.0
dotnet add package PhotoAtomic.Clooney --version 0.6.0
NuGet\Install-Package PhotoAtomic.Clooney -Version 0.6.0
<PackageReference Include="PhotoAtomic.Clooney" Version="0.6.0" />
<PackageVersion Include="PhotoAtomic.Clooney" Version="0.6.0" />
<PackageReference Include="PhotoAtomic.Clooney" />
paket add PhotoAtomic.Clooney --version 0.6.0
#r "nuget: PhotoAtomic.Clooney, 0.6.0"
#:package PhotoAtomic.Clooney@0.6.0
#addin nuget:?package=PhotoAtomic.Clooney&version=0.6.0
#tool nuget:?package=PhotoAtomic.Clooney&version=0.6.0
PhotoAtomic.Clooney
Roslyn source generators for deep clone, structural diff and structural hash of your object graphs — cycle-safe, with zero reflection at runtime: everything is generated at compile time.
using PhotoAtomic.Clooney;
[Clonable]
[Diffable]
[Hashable]
public class BankAccountState
{
public decimal Balance { get; set; }
public int TransactionCount { get; set; }
[SkipClone]
public List<Event> PendingEvents { get; set; } = new();
}
var clone = state.Clone(); // deep copy, [SkipClone] members excluded
var diffs = state.Diff(otherState); // IEnumerable<DifferencePath>: where two graphs diverge
var hash = state.HashValue(); // structural hash of the whole graph
The three generators
| Attribute | Generates | Excludes with |
|---|---|---|
[Clonable] |
Clone() and Clone(CloneContext) extension methods — deep copy; the context tracks references so shared and cyclic instances clone once. |
[SkipClone] |
[Diffable] |
Diff(other) returning DifferencePath items, each a root→leaf chain of nodes pointing at the exact property (or collection slot) that diverges, with current/other values. |
[SkipDiff] |
[Hashable] |
HashValue() — structural hash over the graph, cycle-safe via HashContext. |
[SkipHash] |
Inheritance, interfaces and polymorphic hierarchies are supported: derived types get their own generated methods, and interface-typed properties dispatch to the runtime type.
Installing
dotnet add package PhotoAtomic.Clooney
The package is an analyzer: it runs inside the compiler and adds no runtime dependency
except PhotoAtomic.Clooney.Abstractions
(brought in automatically), which contains the attributes, the interfaces and the
clone/diff/hash contexts your compiled code uses.
Part of PhotoAtomic.Libraries.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- PhotoAtomic.Clooney.Abstractions (>= 0.6.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.