SingularFrameworkCore.Serialization.Newtonsoft.Bson
0.1.0-alpha
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
<PackageReference Include="SingularFrameworkCore.Serialization.Newtonsoft.Bson" Version="0.1.0-alpha" />
paket add SingularFrameworkCore.Serialization.Newtonsoft.Bson --version 0.1.0-alpha
#r "nuget: SingularFrameworkCore.Serialization.Newtonsoft.Bson, 0.1.0-alpha"
// 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
Related Projects
- SingularFrameworkCore - The core framework this implementation is built for
- Newtonsoft.Bson - The Bson library used for serialization
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. |
-
net8.0
- Newtonsoft.Json (>= 13.0.3)
- Newtonsoft.Json.Bson (>= 1.0.3)
- SingularFrameworkCore (>= 0.1.0-alpha)
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 |