Dalion.ValueObjects 1.0.0-beta03

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

License: MIT Nuget Build status Tests status Last commit Stack

ValueObjects <img src="https://dalion.eu/dalion128.png" align="right" width="48">

A C# code generator to cure my Primitive Obsession.

ValueObjects is a .NET Source Generator and analyzer. It turns your primitives (ints, decimals etc.) into value objects that represent domain concepts (CustomerId, AccountBalance etc.).

Please see the Wiki for more detailed information, such as getting started, tutorials, and how-tos.

Give a Star! ⭐

If you like or are using this project please give it a star. Thanks!

Motivation

Creating value objects is a repetitive task. This project aims to reduce the amount of boilerplate code that needs to be written, by generating it.

Inspired by Vogen.

Limitations Overcome

This library addresses several limitations found in similar solutions, such as Vogen:

  • No Run-Time Dependency:
    Unlike e.g. Vogen, which requires Vogen.SharedTypes.dll at run-time, all necessary types are generated alongside your value objects. There are no additional run-time dependencies. All required types are generated at compile-time and generated code is self-contained.

  • Automatic Generation of Pre-Set Values:
    Every value object automatically gets an Empty or Default (configurable) pre-set value, reducing boilerplate and ensuring consistency.

Fundamental Differences in Approach

This library takes a distinct approach to value objects, with perspectives and assumptions that are hard to align with solutions like Vogen.

  • Comparison of Uninitialized Value Objects:
    - Vogen: Treats uninitialized value objects as different from each other.
    - This Library: Considers uninitialized value objects of a type to be equal.

  • Serialization of Uninitialized Value Objects:
    - Vogen: Cannot serialize uninitialized value objects.
    - This Library: Supports serialization and round-tripping of uninitialized value objects.

  • Deserialization of Pre-Set Values:
    - Vogen: Only supports deserialization of pre-set values declared via attributes.
    - This Library: Can deserialize any pre-set value declared as a public static readonly field, even if it does not pass validation.

  • Validation and Error Reporting:
    - Vogen: Validation information is private and inaccessible.
    - This Library: Exposes validation status and error messages, allowing you to check if a value object is valid and retrieve the reason if not. This enables creation of pre-set, initialized, but invalid values.

These assumptions and aproaches reflect my personal perspective on value objects, which may differ from others. For me, they make this library more practical and usable in real-world projects.

Support

If you've got value from any of the content which I have created, but pull requests are not your thing, then I would also very much appreciate your support by buying me a coffee.

<a href="https://www.buymeacoffee.com/DavidLievrouw" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>


"Anybody can make something that works. Software craftsmanship is the ability to keep it understandable, maintainable and extensible."

There are no supported framework assets in this 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.0.0-beta03 120 10/21/2025