HaemmerElectronics.SeppPenner.ProtobufNetPrimitives 1.0.7

Prefix Reserved
dotnet add package HaemmerElectronics.SeppPenner.ProtobufNetPrimitives --version 1.0.7                
NuGet\Install-Package HaemmerElectronics.SeppPenner.ProtobufNetPrimitives -Version 1.0.7                
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.7" />                
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.7                
#r "nuget: HaemmerElectronics.SeppPenner.ProtobufNetPrimitives, 1.0.7"                
#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.7

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

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 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 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. 
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.7 115 5/16/2024
1.0.6 201 12/7/2023
1.0.5 133 11/13/2023
1.0.4 95 11/11/2023
1.0.3 190 4/7/2023
1.0.2 340 11/10/2022
1.0.1 385 10/30/2022
1.0.0 412 2/21/2022

Version 1.0.7.0 (2024-05-16): Removed support for Net7.0.