Delly.Modeling 2026.6.22

dotnet add package Delly.Modeling --version 2026.6.22
                    
NuGet\Install-Package Delly.Modeling -Version 2026.6.22
                    
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="Delly.Modeling" Version="2026.6.22" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Delly.Modeling" Version="2026.6.22" />
                    
Directory.Packages.props
<PackageReference Include="Delly.Modeling" />
                    
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 Delly.Modeling --version 2026.6.22
                    
#r "nuget: Delly.Modeling, 2026.6.22"
                    
#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 Delly.Modeling@2026.6.22
                    
#: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=Delly.Modeling&version=2026.6.22
                    
Install as a Cake Addin
#tool nuget:?package=Delly.Modeling&version=2026.6.22
                    
Install as a Cake Tool

Delly.Modeling

A .NET modeling library that provides source code generation capabilities for object modeling, enabling reflection-like property access and manipulation at compile time through Roslyn Source Generators.

Features

  • Compile-time generation: Property access code is generated at compile time, eliminating runtime reflection overhead
  • AOT-compatible: Works with Ahead-of-Time compilation (e.g., Native AOT)
  • High performance: Up to 10x faster than traditional reflection-based property access
  • Type safety: Compile-time type checking while maintaining dictionary-like property access
  • Zero runtime allocation: Uses static singleton instances for models
  • Framework support: .NET Standard 2.0 and .NET 6.0+

Installation

NuGet Packages

dotnet add package Delly.Modeling
dotnet add package Delly.Modeling.Generator

Quick Start

Mark your class with the [Modelable] attribute and declare it as partial:

using Delly.Modeling;

[Modelable]
public partial class User(string id)
{
    public string Id { get; } = id;
    public string Name { get; set; } = string.Empty;
    public string? Password { get; set; }
    public long Age { get; set; }
}

The source generator will automatically generate code that enables property access:

// Get the model for the User class
var model = User.GetModel();

// Get all property names
var properties = model.GetProperties();
// Returns array of property model objects

// Get a specific property
var ageProperty = model.GetProperty(nameof(User.Age));

// Get property value
var age = ageProperty?.GetValue(user);

// Set property value
ageProperty?.SetValue(user, 25L);

Supported Types

The library includes built-in models for common types:

  • stringStringModel
  • int / Int32Int32Model
  • long / Int64Int64Model
  • bool / BooleanBooleanModel
  • double / DoubleDoubleModel
  • decimal / DecimalDecimalModel
  • DateTimeDateTimeModel
  • GuidGuidModel

Performance

The source generator approach provides significant performance benefits over reflection:

Method 10M Operations Overhead
Reflection ~600ms High
Source Generator ~60ms Minimal

Benchmark results may vary depending on hardware and runtime

Project Structure

  • Delly.Modeling - Core modeling library (.NET Standard 2.0, .NET 6.0)

    • ModelableAttribute - Attribute to mark classes for source generation
    • IModel - Interface for model objects
    • IModelProperty - Interface for model properties
    • Built-in type models in the Models namespace
  • Delly.Modeling.Generator - Roslyn Source Generator (.NET Standard 2.0)

    • ModelableSourceGenerator.cs - Main source generator implementation
    • ModelableSyntaxReceiver.cs - Syntax receiver for collecting [Modelable] classes
  • Deme - Performance benchmark demonstration application (.NET 10.0 with AOT)

  • NugetDemo - NuGet package usage demonstration

Building and Running

# Build the solution
dotnet build

# Run the demo application (with benchmark)
cd Deme
dotnet run

How It Works

  1. Mark a class with [Modelable] and declare it as partial
  2. The source generator scans for classes with this attribute at compile time
  3. Generated code includes:
    • A static GetModel() method that returns the model singleton
    • Property model classes implementing IModelProperty for each property
    • A main model class implementing IModel with property access methods
  4. All generated code is emitted to obj/Generated and compiled with your project

License

See LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
2026.6.22 39 6/3/2026
2026.6.21 43 6/3/2026
2026.5.20 90 5/29/2026
2026.5.19 101 5/28/2026
2026.5.18 101 5/27/2026
2026.5.16 80 5/25/2026
2026.5.12 90 5/25/2026
2026.5.9 93 5/24/2026
2026.5.8 96 5/24/2026
2026.5.7 104 5/24/2026
2026.5.6 89 5/24/2026
2026.5.5 88 5/24/2026
2026.5.4 94 5/23/2026
2026.5.3 94 5/20/2026
2026.5.2 89 5/20/2026
2026.5.1 99 5/20/2026