CoreSystem.Serialization
1.1.0
See the version list below for details.
dotnet add package CoreSystem.Serialization --version 1.1.0
NuGet\Install-Package CoreSystem.Serialization -Version 1.1.0
<PackageReference Include="CoreSystem.Serialization" Version="1.1.0" />
<PackageVersion Include="CoreSystem.Serialization" Version="1.1.0" />
<PackageReference Include="CoreSystem.Serialization" />
paket add CoreSystem.Serialization --version 1.1.0
#r "nuget: CoreSystem.Serialization, 1.1.0"
#:package CoreSystem.Serialization@1.1.0
#addin nuget:?package=CoreSystem.Serialization&version=1.1.0
#tool nuget:?package=CoreSystem.Serialization&version=1.1.0
⚡ Core.Serialization
Production-ready serialization abstraction for .NET 8
Core.Serialization (distributed as the CoreSystem.Serialization NuGet package) provides a unified serialization abstraction for .NET applications, allowing you to seamlessly work with JSON, MessagePack, or Protocol Buffers through a single API.
✨ Features
- ✅ Unified serialization abstraction
- ✅ JSON, MessagePack and Protocol Buffers support
- ✅ Dependency Injection integration
- ✅ Configurable serializer selection
- ✅ Common exception model
- ✅ High-level serialization API
- ✅ Lightweight and reusable
- ✅ Designed for infrastructure libraries
📦 Installation
dotnet add package CoreSystem.Serialization
🚀 Quick Start
Register the library:
builder.Services.AddCoreSerialization(options =>
{
options.DefaultSerializer = SerializerType.Json;
});
Inject the serializer:
public sealed class ProductService(
IPayloadSerializer serializer)
{
}
Serialize an object:
byte[] payload =
serializer.Serialize(product);
Deserialize an object:
Product? restored =
serializer.Deserialize<Product>(payload);
⚙️ Configuration
Customize the serializer during registration.
builder.Services.AddCoreSerialization(options =>
{
options.DefaultSerializer = SerializerType.Json;
// Configure JSON or MessagePack options here.
});
📚 Supported Serializers
JSON
Recommended for:
- Human-readable payloads
- Debugging
- Maximum compatibility
MessagePack
Recommended for:
- High-performance APIs
- Compact payloads
- Low latency
Protocol Buffers
Recommended for:
- Cross-platform communication
- Contract-first serialization
- Compact binary payloads
Protocol Buffers requires serialized types to be compatible with protobuf-net.
[ProtoContract]
public sealed class Product
{
[ProtoMember(1)]
public int Id { get; set; }
[ProtoMember(2)]
public string Name { get; set; } = string.Empty;
}
⚠️ Exception Handling
All serializer-specific exceptions are wrapped by a common exception type.
try
{
var payload =
serializer.Serialize(product);
}
catch (CoreSerializationException ex)
{
Console.WriteLine(ex.Serializer);
}
📊 Why Core.Serialization?
| Capability | Raw Serializer Libraries | CoreSystem.Serialization |
|---|---|---|
| Unified API | ❌ | ✅ |
| Dependency Injection | ❌ | ✅ |
| JSON | ✅ | ✅ |
| MessagePack | ✅ | ✅ |
| Protocol Buffers | ✅ | ✅ |
| Configurable serializer selection | ❌ | ✅ |
| Common exception model | ❌ | ✅ |
🤝 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 (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- protobuf-net (>= 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