HaemmerElectronics.SeppPenner.ProtobufNetPrimitives 1.0.8

Prefix Reserved
dotnet add package HaemmerElectronics.SeppPenner.ProtobufNetPrimitives --version 1.0.8                
NuGet\Install-Package HaemmerElectronics.SeppPenner.ProtobufNetPrimitives -Version 1.0.8                
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="HaemmerElectronics.SeppPenner.ProtobufNetPrimitives" Version="1.0.8" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HaemmerElectronics.SeppPenner.ProtobufNetPrimitives --version 1.0.8                
#r "nuget: HaemmerElectronics.SeppPenner.ProtobufNetPrimitives, 1.0.8"                
#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.
// Install HaemmerElectronics.SeppPenner.ProtobufNetPrimitives as a Cake Addin
#addin nuget:?package=HaemmerElectronics.SeppPenner.ProtobufNetPrimitives&version=1.0.8

// Install HaemmerElectronics.SeppPenner.ProtobufNetPrimitives as a Cake Tool
#tool nuget:?package=HaemmerElectronics.SeppPenner.ProtobufNetPrimitives&version=1.0.8                

ProtobufNetPrimitives

ProtobufNetPrimitives is a library to transfer basic data types with protobuf-net.Grpc.

Build status GitHub issues GitHub forks GitHub stars License: MIT Nuget NuGet Downloads Known Vulnerabilities Gitter Blogger Patreon PayPal

Available for

  • Net 6.0
  • Net 8.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 -
nuint DtoNuint -
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 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 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.8 89 11/24/2024
1.0.7 122 5/16/2024
1.0.6 205 12/7/2023
1.0.5 137 11/13/2023
1.0.4 99 11/11/2023
1.0.3 194 4/7/2023
1.0.2 344 11/10/2022
1.0.1 389 10/30/2022
1.0.0 418 2/21/2022

Version 1.0.8.0 (2024-11-24): Removed support for Net6.0, added support for Net9.0, updated NuGet packages.