DTOMaker.CLI 0.69.2-dev

This is a prerelease version of DTOMaker.CLI.
There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global DTOMaker.CLI --version 0.69.2-dev
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local DTOMaker.CLI --version 0.69.2-dev
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=DTOMaker.CLI&version=0.69.2-dev&prerelease
                    
nuke :add-package DTOMaker.CLI --version 0.69.2-dev
                    

Build-Deploy CodeQL

Warning: This is pre-release software under active development. Breaking changes may occur.

DTOMaker

This repo includes model-driven compile-time source generators for quickly creating DTOs (Data Transport Objects) supporting the following serialization schemes:

  • MessagePack
  • MemBlocks
  • JSON (NewtonSoft)

and related POCOs (Plain Old C# Objects).

Workflow

---
title: Workflow
---
flowchart LR
    def(Define models e.g. IMyDTO.cs)
    ref1(Reference DTOMaker.Models.*)
    ref2(Reference DTOMaker.Runtime.*)
    ref3(Reference one or more source generators e.g. DTOMaker.MessagePack)
    bld(VS/Code/MSBuild)
    pkg(Assembly)
    ref1-->def
    def-->ref2
    def-->ref3
    ref2-->bld
    ref3-->bld
    bld-->pkg

Models are defined as C# interfaces with additional attributes. Here's a trivial example:

[Entity][Id(1)]
public interface IMyFirstDTO
{
    [Member(1)] string Name { get; set; }
}

If using the MessagePack source generator, the following implmentation will be generated (simplified):

[MessagePackObject]
public sealed class MyFirstDTO : EntityBase, IMyFirstDTO, IEquatable<MyFirstDTO>
{
    [Key(1)] string Name { get; set; }
}

Included Packages

This repo includes the following packages:

DTOMaker.Models

Attributes for defining simple data models as interfaces in C#.

DTOMaker.JsonNewtonSoft

A source generator that creates DTOs (Data Transport Objects) that are serializable to JSON using the Newtonsoft.Json package.

DTOMaker.MessagePack

A source generator that creates MessagePack DTOs (Data Transport Objects). See https://github.com/MessagePack-CSharp/MessagePack-CSharp.

DTOMaker.Models.MessagePack

Additional attributes used by the DTOMaker.MessagePack source generator, to manage MessagePack entity and member keys.

DTOMaker.MemBlocks

Generates DTOs whose internal data is a single memory block (Memory<byte>). Property getters and setters decode and encode values directly to the block with little-endian (default) or big-endian byte ordering.

DTOMaker.Models.MemBlocks

Additional attributes used by the DTOMaker.MemBlocks source generator, to manage entity and member memory layout.

DTOMaker.CSPoco

Generates basic POCOs (Plain Old C# Objects) that implement the model interfaces.

DTOMaker.Runtime

Common types used at runtime by DTOMaker generated entities.

Model features

  • Member value types: Boolean, S/Byte, U/Int16/32/64/128, Double, Single, Half, Char, Guid, Decimal
  • String member types
  • Binary member types (Octets)
  • polymorphic types
  • generic types
  • entity members
  • Built-in freezability (mutable until frozen) support
  • [Obsolete] members
  • Fixed length arrays of above value types.
  • IEquatable<T> support
  • Templates as testable code, template-to-generator processing.

MemBlocks features

  • auto-embedded string, binary and entity members when encoded < 63 bytes.
  • fixed-length string and binary member types.

!Limitations

Single compilation unit

All models and generated DTOs are contained within a single assembly. Models cannot reference types in other projects or packages (other than native or built-in types). Generated classes are partial, which can help you mitigate the single assembly constraint.

Development

In progress

  • custom struct members (to avoid primitive obsession)

Coming soon

  • Json (System.Text) generator
  • upgrade source generators to IIncrementalGenerator
  • global interface equality comparer
  • reservation (hidden members)
  • Orleans generator
  • ProtobufNet 3.0 generator
  • MessagePack 3.x generator
  • NetStrux generator
  • MemBlocks compact layout method
  • Enum data types. Workaround - enums can be implemented with an underlying integer property and a cast.
  • MemBlocks nullable types. Workaround - T? can be implemented with a pair of members (Boolean, T).

Coming later

  • Google Protobuf .proto generation
  • model.json generation
  • command-line alternative
  • variable length arrays
  • logical value equality
  • Rune member types
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.71.12 112 10/10/2025
0.71.11 125 10/3/2025
0.71.9 276 9/19/2025
0.71.8 292 9/17/2025
0.71.7 280 9/16/2025
0.71.5 223 9/15/2025
0.71.3 227 9/15/2025
0.71.1 227 9/15/2025
0.70.3 154 9/9/2025
0.70.2 143 9/2/2025
0.70.1-dev 197 8/27/2025
0.69.10 131 8/17/2025
0.69.9 83 8/16/2025
0.69.8 150 8/13/2025
0.69.7-dev 142 8/13/2025
0.69.6-dev 150 8/12/2025
0.69.4-dev 126 8/9/2025
0.69.3-dev 74 7/19/2025
0.69.2-dev 75 7/19/2025
0.68.6 80 7/19/2025
0.68.5-dev 84 7/19/2025
0.68.2-dev 143 7/17/2025
0.68.1-dev 147 7/17/2025
0.67.7 159 7/17/2025
0.67.6-dev 161 7/9/2025
0.67.5-dev 149 7/9/2025
0.67.3-dev 159 7/7/2025
0.67.1-dev 309 6/10/2025
0.66.18 258 6/9/2025
0.66.17-dev 224 6/9/2025
0.66.16-dev 139 6/8/2025
0.66.14-dev 91 6/7/2025
0.66.13-dev 153 6/5/2025
0.66.10-dev 160 6/5/2025
0.66.9-dev 152 6/5/2025
0.66.8-dev 172 6/5/2025
0.66.7-dev 139 6/4/2025
0.66.2-dev 89 5/31/2025
0.65.20-generics-g24a665d336 92 5/31/2025
0.65.13-generics-ge74b19332f 174 4/23/2025
0.65.10-generics-g6f262eb134 223 4/17/2025
0.65.1-generics 94 5/31/2025
0.64.27 166 5/27/2025
0.64.26 217 5/16/2025
0.64.24 173 5/8/2025
0.64.22 193 4/23/2025
0.64.20 185 4/10/2025
0.64.18 180 4/10/2025
0.64.17 197 4/10/2025
0.64.16 182 4/9/2025
0.64.10 185 4/7/2025
0.64.9 154 4/4/2025
0.64.8-dev 169 4/1/2025
0.64.7-dev-g53a80ba3be 170 4/1/2025
0.64.5-dev-g449e36f771 483 3/25/2025
0.64.5-dev-g2fcf9bff64 165 4/1/2025
0.64.4-dev 169 4/1/2025
0.64.3-dev 167 3/31/2025
0.64.2-dev 491 3/25/2025
0.64.1-dev 492 3/25/2025
0.63.60-gee4d301e03 488 3/25/2025
0.63.19 126 3/21/2025
0.63.19-g2e909c64aa 115 3/21/2025
0.63.17 147 3/14/2025
0.63.16 126 3/14/2025
0.63.15 170 3/13/2025
0.63.13 197 3/11/2025
0.63.12 191 3/11/2025
0.63.11-dev 183 3/11/2025
0.63.9-dev 183 3/11/2025
0.63.8-dev 190 3/10/2025
0.63.7-dev 180 3/10/2025
0.63.6-dev 186 3/10/2025
0.63.3-dev 166 3/10/2025
0.62.10 230 3/8/2025
0.62.9 235 3/8/2025
0.62.7 228 3/7/2025
0.62.6-dev 220 3/7/2025
0.62.5-dev 230 3/7/2025
0.61.14 235 3/6/2025
0.61.13-dev 229 3/6/2025
0.61.12-dev 214 3/6/2025
0.61.10-dev 218 3/6/2025
0.61.9-dev 215 3/5/2025
0.61.8-dev 228 3/5/2025
0.61.5-dev 229 3/4/2025
0.61.3-dev 221 3/4/2025
0.61.2-dev 168 3/3/2025
0.60.8 146 2/27/2025
0.60.7 124 2/27/2025
0.60.6-dev 108 2/27/2025
0.60.3-dev 115 2/25/2025
0.59.10 136 2/19/2025
0.59.8-dev 114 2/19/2025
0.59.5-dev 114 2/17/2025
0.59.4-dev 117 2/15/2025
0.58.9 127 2/4/2025
0.58.8-dev 108 2/4/2025
0.57.6 132 2/1/2025
0.57.4 123 2/1/2025
0.57.2-dev 110 2/1/2025
0.57.1-dev 112 2/1/2025
0.56.13 132 1/31/2025
0.56.12-dev 116 1/31/2025
0.56.11-dev 117 1/30/2025
0.56.10-dev 117 1/30/2025
0.56.9-dev 109 1/30/2025
0.56.6-dev 107 1/24/2025
0.56.5-dev 112 1/24/2025
0.56.4-dev 111 1/24/2025
0.56.3-dev 111 1/24/2025
0.55.38 129 1/23/2025
0.55.37-dev 119 1/23/2025
0.55.36-dev 111 1/22/2025
0.55.34-dev 115 1/22/2025
0.55.32-dev 108 1/22/2025
0.55.31-dev 119 1/21/2025
0.55.30-dev 101 1/21/2025
0.55.29-dev 111 1/20/2025
0.55.27-dev 117 1/20/2025
0.55.25-dev 116 1/20/2025
0.55.24-dev 102 1/20/2025
0.55.23-dev 109 1/19/2025
0.55.20-dev 99 1/19/2025
0.55.17-dev 111 1/19/2025
0.55.14-dev 113 1/19/2025