HaemmerElectronics.SeppPenner.ProtobufNetPrimitives
1.1.0
Prefix Reserved
dotnet add package HaemmerElectronics.SeppPenner.ProtobufNetPrimitives --version 1.1.0
NuGet\Install-Package HaemmerElectronics.SeppPenner.ProtobufNetPrimitives -Version 1.1.0
<PackageReference Include="HaemmerElectronics.SeppPenner.ProtobufNetPrimitives" Version="1.1.0" />
<PackageVersion Include="HaemmerElectronics.SeppPenner.ProtobufNetPrimitives" Version="1.1.0" />
<PackageReference Include="HaemmerElectronics.SeppPenner.ProtobufNetPrimitives" />
paket add HaemmerElectronics.SeppPenner.ProtobufNetPrimitives --version 1.1.0
#r "nuget: HaemmerElectronics.SeppPenner.ProtobufNetPrimitives, 1.1.0"
#:package HaemmerElectronics.SeppPenner.ProtobufNetPrimitives@1.1.0
#addin nuget:?package=HaemmerElectronics.SeppPenner.ProtobufNetPrimitives&version=1.1.0
#tool nuget:?package=HaemmerElectronics.SeppPenner.ProtobufNetPrimitives&version=1.1.0
ProtobufNetPrimitives
ProtobufNetPrimitives is a library to transfer basic data types with protobuf-net.Grpc.
Available for
- Net 8.0
- Net 10.0
Net Core and Net Framework latest and LTS versions
Available data types
| Net type | GRPC type | Remark |
|---|---|---|
bool |
DtoBool |
- |
byte |
DtoByte |
- |
char |
DtoChar |
- |
DateTime |
DtoDateTime |
The value is internally stored as long, use the property DateTime to get the correct value. |
DateTimeOffset |
DtoDateTimeOffset |
The value is internally stored as long, use the property DateTimeOffset to get the correct value. |
decimal |
DtoDecimal |
- |
double |
DtoDouble |
- |
float |
DtoFloat |
- |
Guid |
DtoGuid |
The value is internally stored as string, use the property Uuid to get the correct value. |
int |
DtoInt |
- |
long |
DtoLong |
- |
nint |
DtoNint |
The value is internally stored as long, use the property Nint to get the correct value. |
nuint |
DtoNuint |
The value is internally stored as ulong, use the property Nuint to get the correct value. |
sbyte |
DtoSbyte |
- |
short |
DtoShort |
- |
string |
DtoString |
- |
TimeSpan |
DtoTimeSpan |
The value is internally stored as long, use the property TimeSpan to get the correct value. |
uint |
DtoUint |
- |
ulong |
DtoUlong |
- |
ushort |
DtoUshort |
- |
Non-Nullable and Nullable types are supported (Different sub-namespaces).
Why you can't use generics here
/// <summary>
/// The base DTO class.
/// </summary>
[ProtoContract]
[ProtoInclude(1, typeof(DtoBool))]
public class DtoBase<T> where T : new()
{
/// <summary>
/// Initializes a new instance of the <see cref="DtoBase{T}"/> class.
/// </summary>
public DtoBase()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DtoBase{T}"/> class.
/// </summary>
/// <param name="value">The value.</param>
public DtoBase(T value)
{
this.Data = value;
}
/// <summary>
/// Gets or sets the data.
/// </summary>
[ProtoMember(2)]
public T Data { get; set; } = new();
}
/// <summary>
/// The DTO class to transfer bool data.
/// </summary>
[ProtoContract]
public class DtoBool : DtoBase<bool>
{
/// <summary>
/// Initializes a new instance of the <see cref="DtoBool"/> class.
/// </summary>
public DtoBool()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DtoBool"/> class.
/// </summary>
/// <param name="value">The value.</param>
public DtoBool(bool value)
{
this.Data = value;
}
}
throws the error subscribed under https://github.com/protobuf-net/protobuf-net/issues/829 (Not resolved yet).
Install
dotnet add package HaemmerElectronics.SeppPenner.ProtobufNetPrimitives
Change history
See the Changelog.
| Product | Versions 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 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. |
-
net10.0
- protobuf-net.Grpc (>= 1.2.2)
-
net8.0
- protobuf-net.Grpc (>= 1.2.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version 1.1.0.0 (2026-08-15): Removed support for Net9.0 as it is out of support, added support for Net10.0, updated NuGet packages, added unit tests, fixed DtoNint and DtoNuint (protobuf-net has no serializer for nint and nuint, the values now travel as long and ulong, use the new properties Nint and Nuint), fixed the nullable DateTimeOffset property of the non nullable DtoDateTimeOffset. The two fixes change the public API, which is why the minor version is raised.