SingularFrameworkCore.Serialization.Newtonsoft.Bson 0.1.0-alpha

This is a prerelease version of SingularFrameworkCore.Serialization.Newtonsoft.Bson.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package SingularFrameworkCore.Serialization.Newtonsoft.Bson --version 0.1.0-alpha                
NuGet\Install-Package SingularFrameworkCore.Serialization.Newtonsoft.Bson -Version 0.1.0-alpha                
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="SingularFrameworkCore.Serialization.Newtonsoft.Bson" Version="0.1.0-alpha" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SingularFrameworkCore.Serialization.Newtonsoft.Bson --version 0.1.0-alpha                
#r "nuget: SingularFrameworkCore.Serialization.Newtonsoft.Bson, 0.1.0-alpha"                
#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 SingularFrameworkCore.Serialization.Newtonsoft.Bson as a Cake Addin
#addin nuget:?package=SingularFrameworkCore.Serialization.Newtonsoft.Bson&version=0.1.0-alpha&prerelease

// Install SingularFrameworkCore.Serialization.Newtonsoft.Bson as a Cake Tool
#tool nuget:?package=SingularFrameworkCore.Serialization.Newtonsoft.Bson&version=0.1.0-alpha&prerelease                

SingularFrameworkCore.Serialization.Newtonsoft.Bson

A C# library that provides a Bson serializer implementation for the SingularFrameworkCore serialization interface. This library leverages the popular Newtonsoft.Json.Bson library to offer robust serialization and deserialization capabilities.

Features

  • Generic Input Type: Supports serialization and deserialization of any object type.
  • Newtonsoft.Json.Bson: Utilizes the widely-used Newtonsoft.Bson library for Bson operations.
  • Bidirectional Support: Implements both serialization and deserialization.

Installation

The package is available on NuGet. To install it, use the following command:

Install-Package SingularFrameworkCore.Serialization.Newtonsoft.Bson

Or using the .NET CLI:

dotnet add package SingularFrameworkCore.Serialization.Newtonsoft.Bson

Usage

Serialization and Deserialization

using SingularFrameworkCore.Serialization.Newtonsoft.Bson;

// Declare our example model
class MyClass {
    public string Name;
    public int Age;
}

// Create an instance of the BsonSerializer for your specific type
var BsonSerializer = new BsonSerializer<MyClass>();

// Create an object to serialize
var myObject = new MyClass { Name = "John", Age = 30 };

// Serialize the object to a Bson string
string BsonString = BsonSerializer.Serialize(myObject);

// Deserialize the Bson string back to an object
MyClass deserializedObject = BsonSerializer.Deserialize(BsonString);

Integration with SingularFrameworkCore

This library implements the IEntitySerializer<I, O> interface from SingularFrameworkCore, making it ideal for use within the Singular pipeline:

var singular = new Singular<MyClass, byte[]>(
    repository,
    new BsonSerializer<MyClass>(), // Use the Bson serializer
    preProcessors,
    postProcessors
);

Requirements

  • .NET Standard 8.0+
  • Newtonsoft.Bson

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Author

Created by Mohammad Ayaad

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 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. 
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
0.2.0-beta 30 2/18/2025
0.1.0-alpha 34 1/30/2025