DTOMaker.Runtime.JsonNewtonSoft
0.69.10
dotnet add package DTOMaker.Runtime.JsonNewtonSoft --version 0.69.10
NuGet\Install-Package DTOMaker.Runtime.JsonNewtonSoft -Version 0.69.10
<PackageReference Include="DTOMaker.Runtime.JsonNewtonSoft" Version="0.69.10" />
<PackageVersion Include="DTOMaker.Runtime.JsonNewtonSoft" Version="0.69.10" />
<PackageReference Include="DTOMaker.Runtime.JsonNewtonSoft" />
paket add DTOMaker.Runtime.JsonNewtonSoft --version 0.69.10
#r "nuget: DTOMaker.Runtime.JsonNewtonSoft, 0.69.10"
#:package DTOMaker.Runtime.JsonNewtonSoft@0.69.10
#addin nuget:?package=DTOMaker.Runtime.JsonNewtonSoft&version=0.69.10
#tool nuget:?package=DTOMaker.Runtime.JsonNewtonSoft&version=0.69.10
DTOMaker
Warning: This is pre-release software under active development. Breaking changes may occur.
A collection of model-driven compile-time source generators for quickly creating DTOs (Data Transport Objects) supporting the following serialization schemes:
- JSON (NewtonSoft)
- MessagePack
- MemBlocks
and related types.
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 | 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
- DTOMaker.Runtime (>= 0.69.10)
- Microsoft.Bcl.HashCode (>= 6.0.0)
- Newtonsoft.Json (>= 13.0.3)
- System.Memory (>= 4.6.3)
-
net8.0
- DTOMaker.Runtime (>= 0.69.10)
- Microsoft.Bcl.HashCode (>= 6.0.0)
- Newtonsoft.Json (>= 13.0.3)
- System.Memory (>= 4.6.3)
-
net9.0
- DTOMaker.Runtime (>= 0.69.10)
- Microsoft.Bcl.HashCode (>= 6.0.0)
- Newtonsoft.Json (>= 13.0.3)
- System.Memory (>= 4.6.3)
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 |
---|---|---|
0.69.10 | 11 | 8/17/2025 |
0.69.9 | 17 | 8/16/2025 |
0.69.8 | 99 | 8/13/2025 |
0.69.7-dev | 94 | 8/13/2025 |
0.69.6-dev | 92 | 8/12/2025 |
0.69.4-dev | 71 | 8/9/2025 |
0.69.3-dev | 29 | 7/19/2025 |
0.69.2-dev | 17 | 7/19/2025 |
0.68.6 | 21 | 7/19/2025 |
0.68.5-dev | 21 | 7/19/2025 |
0.68.2-dev | 112 | 7/17/2025 |
0.68.1-dev | 111 | 7/17/2025 |
0.67.7 | 110 | 7/17/2025 |
0.67.6-dev | 145 | 7/9/2025 |
0.67.5-dev | 132 | 7/9/2025 |
0.67.3-dev | 134 | 7/7/2025 |
0.67.1-dev | 282 | 6/10/2025 |
0.66.18 | 241 | 6/9/2025 |
0.66.17-dev | 205 | 6/9/2025 |
0.66.16-dev | 113 | 6/8/2025 |
0.66.14-dev | 69 | 6/7/2025 |
0.66.13-dev | 138 | 6/5/2025 |
0.66.10-dev | 139 | 6/5/2025 |
0.66.9-dev | 134 | 6/5/2025 |
0.66.8-dev | 139 | 6/5/2025 |
0.66.7-dev | 130 | 6/4/2025 |
0.66.2-dev | 64 | 5/31/2025 |
0.65.20-generics-g24a665d336 | 63 | 5/31/2025 |
0.65.13-generics-ge74b19332f | 152 | 4/23/2025 |
0.65.10-generics-g6f262eb134 | 185 | 4/17/2025 |
0.65.1-generics | 66 | 5/31/2025 |
0.64.27 | 144 | 5/27/2025 |
0.64.26 | 200 | 5/16/2025 |
0.64.24 | 144 | 5/8/2025 |
0.64.22 | 171 | 4/23/2025 |
0.64.20 | 169 | 4/10/2025 |
0.64.18 | 169 | 4/10/2025 |
0.64.17 | 158 | 4/10/2025 |
0.64.16 | 167 | 4/9/2025 |
0.64.10 | 153 | 4/7/2025 |
0.64.9 | 125 | 4/4/2025 |
0.64.8-dev | 141 | 4/1/2025 |
0.64.7-dev-g53a80ba3be | 142 | 4/1/2025 |
0.64.5-dev-g2fcf9bff64 | 142 | 4/1/2025 |
0.64.4-dev | 143 | 4/1/2025 |