DTOMaker.CLI
1.7.20-dev
See the version list below for details.
dotnet tool install --global DTOMaker.CLI --version 1.7.20-dev
dotnet new tool-manifest
dotnet tool install --local DTOMaker.CLI --version 1.7.20-dev
#tool dotnet:?package=DTOMaker.CLI&version=1.7.20-dev&prerelease
nuke :add-package DTOMaker.CLI --version 1.7.20-dev
DTOMaker
Warning: This is pre-release software under active development. Breaking changes may occur.
Model-driven compile-time source generators for quickly creating polymorphic, freezable DTOs (Data Transport Objects) supporting various serialization protocols:
- JSON (System.Text.Json)
- JSON (Newtonsoft.Json)
- MessagePack 2.x
- MemBlocks
Workflow
flowchart TB
def(Define models e.g. IMyDTO.cs)
ref1(Reference DTOMaker.Models)
ref2(Reference runtime e.g. DTOMaker.Runtime.JsonSystemText)
ref3(Reference source generator e.g. DTOMaker.SrcGen.JsonSystemText)
bld(Build/Run)
ref1-->def
def-->ref2
ref2-->ref3
ref3-->bld
Models are defined as C# interfaces with additional attributes. So let's start with a non-trivial model. Here's how to define a polymorphic, recursive tree type:
using DTOMaker.Models;
using DTOMaker.Runtime;
namespace MyModels;
[Entity(1)] public interface INode : IEntityBase
{
[Member(1)] String Key { get; set; }
}
[Entity(2)] public interface IStringNode : INode
{
[Member(1)] String Value { get; set; }
}
[Entity(3)] public interface INumberNode : INode
{
[Member(1)] Int64 Value { get; set; }
}
[Entity(4)] public interface ITree : IEntityBase
{
[Member(1)] ITree? Left { get; set; }
[Member(2)] ITree? Right { get; set; }
[Member(3)] INode? Node { get; set; }
}
When you add a reference to the DTOMaker.SrcGen.JsonSystemText package, the implmentations will be generated in the MyModels.JsonSystemText namespace.
Development
In progress
- custom value type converters
Coming soon
- more custom (ref and value) type converters
Coming later
- MessagePack 3.x serialization
- Orleans serialization
- Protobuf.Net serialization
- model.json generation
- command-line alternative
- variant native type support
- variable length arrays
- logical value equality
- common pattern extensions
How to sponsor
If you find these tools useful, please consider sponsoring my work on GitHub at https://github.com/sponsors/Psiman62 or buy me a coffee at https://www.buymeacoffee.com/psiman62
License
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.20-dev | 26 | 3/5/2026 |
| 2.0.19-dev | 27 | 3/5/2026 |
| 2.0.18-dev | 29 | 3/5/2026 |
| 2.0.17-dev | 72 | 3/3/2026 |
| 2.0.16-dev | 71 | 3/3/2026 |
| 2.0.15-dev | 80 | 3/1/2026 |
| 2.0.13-dev | 79 | 2/27/2026 |
| 2.0.9-dev | 80 | 2/27/2026 |
| 2.0.7-dev | 80 | 2/26/2026 |
| 1.11.8-dev | 83 | 2/20/2026 |
| 1.10.4 | 90 | 2/14/2026 |
| 1.9.5 | 109 | 2/7/2026 |
| 1.9.4-dev | 92 | 2/6/2026 |
| 1.9.2-dev | 89 | 2/1/2026 |
| 1.8.7 | 108 | 1/26/2026 |
| 1.8.6 | 103 | 1/23/2026 |
| 1.8.4 | 104 | 1/22/2026 |
| 1.8.1-dev | 101 | 1/22/2026 |
| 1.7.25 | 90 | 1/19/2026 |
| 1.7.20-dev | 99 | 1/18/2026 |