CoreSystem.Serialization
1.0.0
See the version list below for details.
dotnet add package CoreSystem.Serialization --version 1.0.0
NuGet\Install-Package CoreSystem.Serialization -Version 1.0.0
<PackageReference Include="CoreSystem.Serialization" Version="1.0.0" />
<PackageVersion Include="CoreSystem.Serialization" Version="1.0.0" />
<PackageReference Include="CoreSystem.Serialization" />
paket add CoreSystem.Serialization --version 1.0.0
#r "nuget: CoreSystem.Serialization, 1.0.0"
#:package CoreSystem.Serialization@1.0.0
#addin nuget:?package=CoreSystem.Serialization&version=1.0.0
#tool nuget:?package=CoreSystem.Serialization&version=1.0.0
⚡ CoreSystem.Serialization
Production-ready serialization abstraction for .NET 8
CoreSystem.Serialization provides a unified serialization abstraction for .NET applications, allowing you to switch between JSON, MessagePack, and Protocol Buffers without changing your application code. It integrates seamlessly with the Microsoft dependency injection container and exposes a consistent API across all supported serializers.
✨ Features
- ✅ Unified serialization API
- ✅ JSON serialization
- ✅ MessagePack serialization
- ✅ Protocol Buffers serialization
- ✅ Dependency Injection integration
- ✅ Configurable serialization options
- ✅ Common exception model
- ✅ Lightweight and provider-agnostic design
📦 Installation
dotnet add package CoreSystem.Serialization
🚀 Quick Start
Register the framework:
builder.Services.AddCoreSerialization(options =>
{
options.DefaultSerializer = SerializerType.Json;
});
Inject the serializer factory:
public sealed class ProductService(
ISerializerFactory serializerFactory)
{
}
Resolve a serializer:
var serializer =
serializerFactory.GetSerializer(
SerializerType.Json);
Serialize an object:
byte[] payload =
serializer.Serialize(product);
Deserialize an object:
Product? product =
serializer.Deserialize<Product>(payload);
⚙️ Configuration
Customize serialization behavior during registration.
builder.Services.AddCoreSerialization(options =>
{
// Configure JSON or MessagePack options here.
});
📚 Supported Serializers
JSON
Recommended for:
- Human-readable payloads
- Debugging
- Maximum compatibility
var serializer =
serializerFactory.GetSerializer(
SerializerType.Json);
MessagePack
Recommended for:
- High-performance APIs
- Compact payloads
- Low latency
var serializer =
serializerFactory.GetSerializer(
SerializerType.MessagePack);
Protocol Buffers
Recommended for:
- Cross-platform communication
- Contract-first serialization
- Compact binary payloads
var serializer =
serializerFactory.GetSerializer(
SerializerType.Protobuf);
📦 Payload Format
CoreSystem.Serialization automatically determines how payloads are stored based on the selected serializer.
| Serializer | Payload Format |
|---|---|
| JSON | Stored as plain UTF-8 JSON without additional metadata. |
| MessagePack | Stored as binary data with a serializer identifier header. |
| Protocol Buffers | Stored as binary data with a serializer identifier header. |
The serializer identifier allows binary payloads to be deserialized automatically without requiring consumers to know which serializer was originally used.
⚠️ Exception Handling
All serializer-specific exceptions are wrapped in a common exception type.
try
{
var payload = serializer.Serialize(product);
}
catch (CoreSerializationException ex)
{
Console.WriteLine(ex.Serializer);
}
📊 Why CoreSystem.Serialization?
Capability Raw Serializer Libraries CoreSystem.Serialization
Unified API ❌ ✅ JSON ✅ ✅ MessagePack ✅ ✅ Protocol Buffers ✅ ✅ Dependency Injection ❌ ✅ Factory Pattern ❌ ✅ Common Exception Model ❌ ✅ Configurable Options Limited ✅
📚 Documentation
The complete documentation includes:
- Getting Started
- Configuration
- JSON Serialization
- MessagePack Serialization
- Protocol Buffers Serialization
- Dependency Injection
- Exception Handling
- Best Practices
Visit the GitHub repository for the complete documentation.
🤝 Contributing
Issues, discussions and pull requests are welcome.
📄 License
Released under the MIT License.
| 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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- MessagePack (>= 3.1.7)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- protobuf-net (>= 3.2.56)
- protobuf-net.Core (>= 3.2.56)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on CoreSystem.Serialization:
| Package | Downloads |
|---|---|
|
CoreSystem.Cache
Distributed cache abstraction for .NET 8 supporting Redis and In-Memory providers, with native OpenTelemetry integration. |
|
|
CoreSystem.Idempotency
Production-ready idempotency framework for ASP.NET Core that guarantees exactly-once request processing with Redis and PostgreSQL providers, request fingerprinting, response replay, and native OpenTelemetry support. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial stable release.
• Unified serialization abstraction
• JSON serializer
• MessagePack serializer
• Protocol Buffers serializer
• Dependency Injection integration