DTOMaker.Models 0.69.2-dev

This is a prerelease version of DTOMaker.Models.
There is a newer version of this package available.
See the version list below for details.
dotnet add package DTOMaker.Models --version 0.69.2-dev
                    
NuGet\Install-Package DTOMaker.Models -Version 0.69.2-dev
                    
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="DTOMaker.Models" Version="0.69.2-dev" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DTOMaker.Models" Version="0.69.2-dev" />
                    
Directory.Packages.props
<PackageReference Include="DTOMaker.Models" />
                    
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 DTOMaker.Models --version 0.69.2-dev
                    
#r "nuget: DTOMaker.Models, 0.69.2-dev"
                    
#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 DTOMaker.Models@0.69.2-dev
                    
#: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=DTOMaker.Models&version=0.69.2-dev&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DTOMaker.Models&version=0.69.2-dev&prerelease
                    
Install as a Cake Tool

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 net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 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 is compatible.  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 (4)

Showing the top 4 NuGet packages that depend on DTOMaker.Models:

Package Downloads
DTOMaker.Runtime.MemBlocks

Runtime types for generated entities

DTOMaker.Runtime.JsonNewtonSoft

Runtime types for generated entities

DTOMaker.Runtime.JsonSystemText

Runtime types for generated entities

DTOMaker.Runtime.MsgPack2

Runtime types for generated entities

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.7.25 236 1/19/2026
1.7.22 237 1/18/2026
1.7.20-dev 235 1/18/2026
1.7.18-dev 77 1/18/2026
1.7.8-dev 83 1/17/2026
1.7.1-dev 82 1/8/2026
1.6.12 92 1/6/2026
1.6.10 88 1/4/2026
1.6.2 86 1/3/2026
1.6.1 89 1/3/2026
1.5.23 89 1/1/2026
1.5.22-dev 87 1/1/2026
1.5.19-dev 80 1/1/2026
1.5.18-dev 86 12/28/2025
1.5.13-dev 81 12/27/2025
1.5.4-dev 130 12/26/2025
1.4.17 161 12/26/2025
1.4.16 173 12/25/2025
1.4.10 172 12/24/2025
1.4.8 173 12/24/2025
1.4.7-dev 168 12/23/2025
1.4.4-dev 163 12/22/2025
1.3.6 140 12/20/2025
1.3.5-dev 122 12/20/2025
1.3.4-dev 137 12/20/2025
1.3.3-dev 224 12/19/2025
1.2.11 257 12/17/2025
1.2.10 258 12/17/2025
1.2.9 266 12/17/2025
1.2.8-dev 265 12/17/2025
1.2.7-dev 266 12/17/2025
1.2.6-dev 260 12/17/2025
1.2.5-dev 255 12/17/2025
1.2.4-dev 264 12/17/2025
0.72.6 190 11/27/2025
0.72.5 345 11/17/2025
0.72.4 283 11/13/2025
0.72.3 282 11/13/2025
0.71.12 154 10/10/2025
0.71.11 170 10/3/2025
0.71.9 303 9/19/2025
0.71.8 326 9/17/2025
0.71.7 330 9/16/2025
0.71.5 271 9/15/2025
0.71.3 257 9/15/2025
0.71.1 268 9/15/2025
0.70.3 195 9/9/2025
0.70.2 199 9/2/2025
0.70.1-dev 226 8/27/2025
0.69.10 160 8/17/2025
0.69.9 121 8/16/2025
0.69.8 199 8/13/2025
0.69.7-dev 185 8/13/2025
0.69.6-dev 180 8/12/2025
0.69.4-dev 153 8/9/2025
0.69.3-dev 107 7/19/2025
0.69.2-dev 100 7/19/2025
0.68.6 108 7/19/2025
0.68.5-dev 106 7/19/2025
0.68.2-dev 184 7/17/2025
0.68.1-dev 174 7/17/2025
0.67.7 182 7/17/2025
0.67.6-dev 187 7/9/2025
0.67.5-dev 177 7/9/2025
0.67.3-dev 186 7/7/2025
0.67.1-dev 332 6/10/2025
0.66.18 290 6/9/2025
0.66.17-dev 259 6/9/2025
0.66.16-dev 157 6/8/2025
0.66.14-dev 124 6/7/2025
0.66.13-dev 185 6/5/2025
0.66.10-dev 194 6/5/2025
0.66.9-dev 179 6/5/2025
0.66.8-dev 187 6/5/2025
0.66.7-dev 180 6/4/2025
0.66.2-dev 105 5/31/2025
0.65.20-generics-g24a665d336 109 5/31/2025
0.65.13-generics-ge74b19332f 205 4/23/2025
0.65.10-generics-g6f262eb134 256 4/17/2025
0.65.1-generics 105 5/31/2025
0.64.27 194 5/27/2025
0.64.26 255 5/16/2025
0.64.24 192 5/8/2025
0.64.22 211 4/23/2025
0.64.20 218 4/10/2025
0.64.18 210 4/10/2025
0.64.17 208 4/10/2025
0.64.16 200 4/9/2025
0.64.10 216 4/7/2025
0.64.9 170 4/4/2025
0.64.8-dev 194 4/1/2025
0.64.7-dev-g53a80ba3be 182 4/1/2025
0.64.5-dev-g449e36f771 509 3/25/2025
0.64.5-dev-g2fcf9bff64 191 4/1/2025
0.64.4-dev 192 4/1/2025
0.64.3-dev 188 3/31/2025
0.64.2-dev 510 3/25/2025
0.64.1-dev 509 3/25/2025
0.63.60-gee4d301e03 514 3/25/2025
0.63.19 157 3/21/2025
0.63.19-g2e909c64aa 141 3/21/2025
0.63.17 167 3/14/2025
0.63.16 161 3/14/2025
0.63.15 193 3/13/2025
0.63.13 224 3/11/2025
0.63.12 212 3/11/2025
0.63.11-dev 214 3/11/2025
0.63.9-dev 204 3/11/2025
0.63.8-dev 203 3/10/2025
0.63.7-dev 208 3/10/2025
0.63.6-dev 207 3/10/2025
0.63.3-dev 195 3/10/2025
0.62.10 272 3/8/2025
0.62.9 268 3/8/2025
0.62.7 261 3/7/2025
0.62.6-dev 251 3/7/2025
0.62.5-dev 244 3/7/2025
0.61.14 269 3/6/2025
0.61.13-dev 256 3/6/2025
0.61.12-dev 257 3/6/2025
0.61.10-dev 242 3/6/2025
0.61.9-dev 240 3/5/2025
0.61.8-dev 245 3/5/2025
0.61.5-dev 242 3/4/2025
0.61.3-dev 252 3/4/2025
0.61.2-dev 181 3/3/2025
0.60.8 177 2/27/2025
0.60.7 149 2/27/2025
0.60.6-dev 134 2/27/2025
0.60.3-dev 134 2/25/2025
0.59.10 163 2/19/2025
0.59.8-dev 127 2/19/2025
0.59.5-dev 143 2/17/2025
0.59.4-dev 143 2/15/2025
0.58.9 165 2/4/2025
0.58.8-dev 140 2/4/2025
0.57.6 163 2/1/2025
0.57.4 156 2/1/2025
0.57.2-dev 138 2/1/2025
0.57.1-dev 137 2/1/2025
0.56.13 155 1/31/2025
0.56.12-dev 137 1/31/2025
0.56.11-dev 134 1/30/2025
0.56.10-dev 139 1/30/2025
0.56.9-dev 135 1/30/2025
0.56.6-dev 123 1/24/2025
0.56.5-dev 125 1/24/2025
0.56.4-dev 123 1/24/2025
0.56.3-dev 120 1/24/2025
0.55.38 147 1/23/2025
0.55.37-dev 133 1/23/2025
0.55.36-dev 132 1/22/2025
0.55.34-dev 119 1/22/2025
0.55.32-dev 113 1/22/2025
0.55.31-dev 136 1/21/2025
0.55.30-dev 129 1/21/2025
0.55.29-dev 128 1/20/2025
0.55.27-dev 129 1/20/2025
0.55.25-dev 124 1/20/2025
0.55.24-dev 134 1/20/2025
0.55.23-dev 130 1/19/2025
0.55.20-dev 124 1/19/2025
0.55.17-dev 122 1/19/2025
0.55.14-dev 129 1/19/2025
0.55.3-dev 135 1/9/2025
0.55.2-dev 106 1/9/2025
0.54.2 154 1/3/2025
0.54.1-dev 129 1/3/2025
0.53.3 162 1/1/2025
0.53.2 173 12/31/2024
0.53.1-dev 137 12/31/2024
0.51.2 165 12/31/2024
0.51.1 143 12/31/2024
0.50.3 153 12/31/2024
0.50.2-dev 133 12/31/2024
0.50.1-dev 126 12/31/2024
0.49.7 149 12/31/2024
0.49.6 151 12/29/2024
0.49.5-dev 129 12/29/2024
0.49.4-dev 131 12/29/2024
0.48.5 144 12/29/2024
0.48.4-dev 137 12/28/2024
0.48.3-dev 133 12/28/2024
0.48.2-dev 135 12/28/2024
0.48.1-dev 136 12/28/2024
0.47.1 149 12/27/2024
0.46.9 152 12/27/2024
0.46.8 156 12/27/2024
0.46.7 147 12/27/2024
0.46.6 151 12/23/2024
0.46.5 154 12/23/2024
0.46.4 150 12/22/2024
0.46.3 148 12/22/2024
0.46.2-dev 130 12/22/2024
0.46.1-dev 137 12/22/2024
0.45.4 146 12/21/2024
0.45.3-dev 137 12/20/2024
0.45.2-dev 126 12/20/2024
0.44.4 154 12/19/2024
0.44.3 144 12/19/2024
0.44.2 145 12/19/2024
0.44.1 135 12/19/2024
0.43.5 136 12/19/2024
0.43.4 142 12/19/2024
0.43.3 154 12/19/2024
0.43.2-dev 143 12/19/2024
0.43.1-dev 139 12/18/2024
0.42.2 156 12/18/2024
0.42.1-dev 132 12/18/2024
0.41.6 154 12/18/2024
0.41.5-dev 141 12/18/2024
0.40.16 142 12/17/2024
0.40.14 146 12/16/2024
0.40.12-dev 139 12/16/2024
0.40.3-dev 134 12/3/2024
0.40.1-dev 134 12/3/2024
0.39.2 146 12/3/2024
0.39.1-dev 127 12/2/2024
0.38.4 148 11/30/2024
0.38.3-dev 129 11/30/2024
0.38.2-dev 137 11/30/2024
0.38.1-dev 128 11/25/2024
0.37.3 154 11/24/2024
0.37.2 156 11/23/2024
0.37.1 149 11/23/2024
0.36.6 151 11/23/2024
0.36.5 158 11/22/2024
0.36.4 139 11/22/2024
0.36.2 149 11/20/2024
0.34.1 148 11/17/2024