HaemmerElectronics.SeppPenner.ProtobufNetPrimitives 1.0.6

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package HaemmerElectronics.SeppPenner.ProtobufNetPrimitives --version 1.0.6
NuGet\Install-Package HaemmerElectronics.SeppPenner.ProtobufNetPrimitives -Version 1.0.6
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.6" />
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.6
#r "nuget: HaemmerElectronics.SeppPenner.ProtobufNetPrimitives, 1.0.6"
#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.6

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

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

Available for

  • Net 6.0
  • Net 7.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 net6.0 is compatible.  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 is compatible.  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. 
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.6 170 12/7/2023
1.0.5 104 11/13/2023
1.0.4 66 11/11/2023
1.0.3 161 4/7/2023
1.0.2 312 11/10/2022
1.0.1 357 10/30/2022
1.0.0 387 2/21/2022

Version 1.0.6.0 (2023-12-07): Updated NuGet packages, added support for Net8.0.