DTOMaker.Models
0.65.1-generics
See the version list below for details.
dotnet add package DTOMaker.Models --version 0.65.1-generics
NuGet\Install-Package DTOMaker.Models -Version 0.65.1-generics
<PackageReference Include="DTOMaker.Models" Version="0.65.1-generics" />
<PackageVersion Include="DTOMaker.Models" Version="0.65.1-generics" />
<PackageReference Include="DTOMaker.Models" />
paket add DTOMaker.Models --version 0.65.1-generics
#r "nuget: DTOMaker.Models, 0.65.1-generics"
#:package DTOMaker.Models@0.65.1-generics
#addin nuget:?package=DTOMaker.Models&version=0.65.1-generics&prerelease
#tool nuget:?package=DTOMaker.Models&version=0.65.1-generics&prerelease
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; }
}
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.CSRecord (.NET 8+)
Generates C# records 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 (model interfaces, CSPoco, CSRecord, MemBlocks)
- ReadOnlyMemory<byte> (MessagePack)
- byte[] (JsonNewtonSoft)
- polymorphic 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)
- generic/open types
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 | Versions 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. |
-
.NETStandard 2.0
- System.Memory (>= 4.6.3)
-
net8.0
- System.Memory (>= 4.6.3)
-
net9.0
- System.Memory (>= 4.6.3)
NuGet packages (6)
Showing the top 5 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 |
|
|
DTOMaker.Models.BinaryTree
Interface and extension methods for managing binary tree structures. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.49 | 0 | 4/26/2026 |
| 2.0.48 | 28 | 4/25/2026 |
| 2.0.46-dev | 22 | 4/25/2026 |
| 2.0.45-dev | 286 | 4/16/2026 |
| 2.0.39-dev | 293 | 4/2/2026 |
| 2.0.38-dev | 296 | 3/31/2026 |
| 2.0.36-dev | 291 | 3/31/2026 |
| 2.0.29-dev | 284 | 3/17/2026 |
| 2.0.28-dev | 317 | 3/17/2026 |
| 2.0.26-dev | 371 | 3/15/2026 |
| 2.0.25-dev | 368 | 3/12/2026 |
| 2.0.24-dev | 288 | 3/7/2026 |
| 2.0.23-dev | 284 | 3/7/2026 |
| 2.0.20-dev | 289 | 3/5/2026 |
| 2.0.19-dev | 290 | 3/5/2026 |
| 2.0.18-dev | 287 | 3/5/2026 |
| 2.0.17-dev | 293 | 3/3/2026 |
| 2.0.16-dev | 294 | 3/3/2026 |
| 2.0.15-dev | 298 | 3/1/2026 |
| 0.65.1-generics | 119 | 5/31/2025 |