Skip to content

Commit 85ddbf4

Browse files
committed
Updated docs for data serialization project
1 parent ff3138b commit 85ddbf4

File tree

5 files changed

+66
-3
lines changed

5 files changed

+66
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ As many developers know, projects like MADE.NET are built and maintained in spar
2828
| Collections | [![NuGet](https://img.shields.io/nuget/v/MADE.Collections)](https://www.nuget.org/packages/MADE.Collections/) | [![Nuget](https://img.shields.io/nuget/vpre/MADE.Collections.svg)](https://www.nuget.org/packages/MADE.Collections/) | [![NuGet Downloads](https://img.shields.io/nuget/dt/MADE.Collections.svg)](https://www.nuget.org/packages/MADE.Collections) |
2929
| Data.Converters | [![NuGet](https://img.shields.io/nuget/v/MADE.Data.Converters)](https://www.nuget.org/packages/MADE.Data.Converters/) | [![NuGet](https://img.shields.io/nuget/vpre/MADE.Data.Converters)](https://www.nuget.org/packages/MADE.Data.Converters/) | [![NuGet Downloads](https://img.shields.io/nuget/dt/MADE.Data.Converters.svg)](https://www.nuget.org/packages/MADE.Data.Converters) |
3030
| Data.EFCore | [![NuGet](https://img.shields.io/nuget/v/MADE.Data.EFCore)](https://www.nuget.org/packages/MADE.Data.EFCore/) | [![NuGet](https://img.shields.io/nuget/vpre/MADE.Data.EFCore)](https://www.nuget.org/packages/MADE.Data.EFCore/) | [![NuGet Downloads](https://img.shields.io/nuget/dt/MADE.Data.EFCore.svg)](https://www.nuget.org/packages/MADE.Data.EFCore) |
31+
| Data.Serialization | [![NuGet](https://img.shields.io/nuget/v/MADE.Data.Serialization)](https://www.nuget.org/packages/MADE.Data.Serialization/) | [![NuGet](https://img.shields.io/nuget/vpre/MADE.Data.Serialization)](https://www.nuget.org/packages/MADE.Data.Serialization/) | [![NuGet Downloads](https://img.shields.io/nuget/dt/MADE.Data.Serialization.svg)](https://www.nuget.org/packages/MADE.Data.Serialization) |
3132
| Data.Validation | [![NuGet](https://img.shields.io/nuget/v/MADE.Data.Validation)](https://www.nuget.org/packages/MADE.Data.Validation/) | [![NuGet](https://img.shields.io/nuget/vpre/MADE.Data.Validation)](https://www.nuget.org/packages/MADE.Data.Validation/) | [![NuGet Downloads](https://img.shields.io/nuget/dt/MADE.Data.Validation.svg)](https://www.nuget.org/packages/MADE.Data.Validation) |
33+
| Data.Validation.FluentValidation | [![NuGet](https://img.shields.io/nuget/v/MADE.Data.Validation.FluentValidation)](https://www.nuget.org/packages/MADE.Data.Validation.FluentValidation/) | [![NuGet](https://img.shields.io/nuget/vpre/MADE.Data.Validation.FluentValidation)](https://www.nuget.org/packages/MADE.Data.Validation.FluentValidation/) | [![NuGet Downloads](https://img.shields.io/nuget/dt/MADE.Data.Validation.FluentValidation.svg)](https://www.nuget.org/packages/MADE.Data.Validation.FluentValidation) |
3234
| Diagnostics | [![NuGet](https://img.shields.io/nuget/v/MADE.Diagnostics)](https://www.nuget.org/packages/MADE.Diagnostics/) | [![NuGet](https://img.shields.io/nuget/vpre/MADE.Diagnostics)](https://www.nuget.org/packages/MADE.Diagnostics/) | [![NuGet Downloads](https://img.shields.io/nuget/dt/MADE.Diagnostics.svg)](https://www.nuget.org/packages/MADE.Diagnostics) |
3335
| Foundation | [![NuGet](https://img.shields.io/nuget/v/MADE.Foundation)](https://www.nuget.org/packages/MADE.Foundation/) | [![NuGet](https://img.shields.io/nuget/vpre/MADE.Foundation)](https://www.nuget.org/packages/MADE.Foundation/) | [![NuGet Downloads](https://img.shields.io/nuget/dt/MADE.Foundation.svg)](https://www.nuget.org/packages/MADE.Foundation) |
3436
| Networking | [![NuGet](https://img.shields.io/nuget/v/MADE.Networking)](https://www.nuget.org/packages/MADE.Networking/) | [![NuGet](https://img.shields.io/nuget/vpre/MADE.Networking)](https://www.nuget.org/packages/MADE.Networking/) | [![NuGet Downloads](https://img.shields.io/nuget/dt/MADE.Networking.svg)](https://www.nuget.org/packages/MADE.Networking) |
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
uid: package-data-serialization
3+
title: Using the Data Serialization package
4+
---
5+
6+
# Using the Data Serialization package
7+
8+
The Data Serialization package provides a collection of helpers and extensions for data serialization in different types, e.g. JSON.
9+
10+
## Handling type changes in JSON objects serialized with JSON.NET with TypeNameHandling set to All
11+
12+
There are many ways to use JSON.NET in your applications to serialize and deserialize data. This includes the ability to set the `TypeNameHandling` property to `All` include your .NET type information within your serialized data.
13+
14+
This can come with challenges when you want to use the same data in different solutions, or when you want to perform refactors or data restructures in your codebase.
15+
16+
The `JsonTypeMigrationSerializationBinder` class provides a way to handle type changes in JSON objects serialized with JSON.NET, migrating from one type to another (whether known within your codebase or not).
17+
18+
Here's how to setup your application for migrating JSON objects from one type to another.
19+
20+
```csharp
21+
namespace App.Migrations
22+
{
23+
using MADE.Data.Serialization.Json;
24+
using MADE.Data.Serialization.Json.Binders;
25+
26+
public class JsonSerializer
27+
{
28+
public JsonSerializer()
29+
{
30+
JsonSerializerSettings.Default.TypeNameHandling = TypeNameHandling.All;
31+
JsonSerializerSettings.Default.Binder = new JsonTypeMigrationSerializationBinder(
32+
new JsonTypeMigration(typeof(OldType), typeof(NewType)),
33+
new JsonTypeMigration("App.Migrations", "App.Migrations.Data.OldDataType", typeof(NewType))
34+
);
35+
}
36+
37+
public T Deserialize<T>(string serializedJson)
38+
{
39+
return JsonConvert.DeserializeObject<T>(serializedJson);
40+
}
41+
}
42+
}
43+
```

docs/articles/intro.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ dotnet add package MADE.Collections
2828
| MADE.Collections | [![NuGet](https://img.shields.io/nuget/v/MADE.Collections)](https://www.nuget.org/packages/MADE.Collections/) |
2929
| MADE.Data.Converters | [![NuGet](https://img.shields.io/nuget/v/MADE.Data.Converters)](https://www.nuget.org/packages/MADE.Data.Converters/) |
3030
| MADE.Data.EFCore | [![NuGet](https://img.shields.io/nuget/v/MADE.Data.EFCore)](https://www.nuget.org/packages/MADE.Data.EFCore/) |
31+
| MADE.Data.Serialization | [![NuGet](https://img.shields.io/nuget/v/MADE.Data.Serialization)](https://www.nuget.org/packages/MADE.Data.Serialization/) |
3132
| MADE.Data.Validation | [![NuGet](https://img.shields.io/nuget/v/MADE.Data.Validation)](https://www.nuget.org/packages/MADE.Data.Validation/) |
3233
| MADE.Data.Validation.FluentValidation | [![NuGet](https://img.shields.io/nuget/v/MADE.Data.Validation.FluentValidation)](https://www.nuget.org/packages/MADE.Data.Validation.FluentValidation/) |
3334
| MADE.Diagnostics | [![NuGet](https://img.shields.io/nuget/v/MADE.Diagnostics)](https://www.nuget.org/packages/MADE.Diagnostics/) |
35+
| MADE.Foundation | [![NuGet](https://img.shields.io/nuget/v/MADE.Foundation)](https://www.nuget.org/packages/MADE.Foundation/) |
3436
| MADE.Networking | [![NuGet](https://img.shields.io/nuget/v/MADE.Networking)](https://www.nuget.org/packages/MADE.Networking/) |
3537
| MADE.Runtime | [![NuGet](https://img.shields.io/nuget/v/MADE.Runtime)](https://www.nuget.org/packages/MADE.Runtime/) |
3638
| MADE.Testing | [![NuGet](https://img.shields.io/nuget/v/MADE.Testing)](https://www.nuget.org/packages/MADE.Testing/) |
@@ -87,6 +89,20 @@ It includes features such as:
8789

8890
</span>
8991

92+
#### Data.Serialization
93+
94+
The Data Serialization package provides a collection of helpers and extensions for data serialization in different types, e.g. JSON.
95+
96+
It includes features such as:
97+
98+
- JsonTypeMigrationSerializationBinder, for migrating type names within a serialized JSON object.
99+
100+
<span class="button">
101+
102+
[Discover Data.Serialization](features/data-serialization.md)
103+
104+
</span>
105+
90106
#### Data.Validation
91107

92108
The Data Validation package is designed to provide out-of-the-box data validation to applications built with C#.

docs/articles/toc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
href: features/data-converters.md
99
- name: Data EF Core
1010
href: features/data-efcore.md
11+
- name: Data Serialization
12+
href: features/data-serialization.md
1113
- name: Data Validation
1214
href: features/data-validation.md
1315
- name: Diagnostics
@@ -25,4 +27,4 @@
2527
- name: Web
2628
href: features/web.md
2729
- name: Web MVC
28-
href: features/web-mvc.md
30+
href: features/web-mvc.md

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ title: Make App Development Easier
122122
<div class="stat-container">
123123
<div class="stat-header">
124124
<span>
125-
275k+
125+
300k+
126126
</span>
127127
</div>
128128
<div class="stat-content">
@@ -138,7 +138,7 @@ title: Make App Development Easier
138138
<div class="stat-container">
139139
<div class="stat-header">
140140
<span>
141-
22
141+
27
142142
</span>
143143
</div>
144144
<div class="stat-content">

0 commit comments

Comments
 (0)