You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/articles/networking/serialization.md
+77Lines changed: 77 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -303,3 +303,80 @@ akka {
303
303
}
304
304
}
305
305
```
306
+
307
+
## Cross platform serialization compatibility in Hyperion
308
+
There are problems that can arise when migrating from old .NET Framework to the new .NET Core standard, mainly because of breaking namespace and assembly name changes between these platforms.
309
+
Hyperion implements a generic way of addressing this issue by transforming the names of these incompatible names during deserialization.
310
+
311
+
There are two ways to set this up, one through the HOCON configuration file, and the other by using the `HyperionSerializerSetup` class.
312
+
313
+
> [!NOTE]
314
+
> Only the first successful name transformation is applied, the rest are ignored.
315
+
> If you are matching several similar names, make sure that you order them from the most specific match to the least specific one.
In the example above, we're addressing the classic case where the core library name was changed between `mscorlib` in .NET Framework to `System.Private.CoreLib` in .NET Core.
343
+
This transform is already included inside Hyperion as the default cross platform support, and used here as an illustration only.
344
+
345
+
The HOCON configuration section is composed of three object arrays named `netfx`, `netcore`, and `net`, each corresponds, respectively, to .NET Framework, .NET Core, and the new .NET 5.0 and beyond.
346
+
The Hyperion serializer will automatically detects the platform it is running on currently and uses the correct array to use inside its deserializer. For example, if Hyperion detects
347
+
that it is running under .NET framework, then it will use the `netfx` array to do its deserialization transformation.
348
+
349
+
The way it works that when the serializer detects that the type name contains the `fingerprint` string, it will replace the string declared in the `rename-from`
350
+
property into the string declared in the `rename-to`.
/// Creates a new instance of a <see cref="HyperionSerializerSettings"/>.
212
259
/// </summary>
213
260
/// <param name="preserveObjectReferences">Flag which determines if serializer should keep track of references in serialized object graph.</param>
214
261
/// <param name="versionTolerance">Flag which determines if field data should be serialized as part of type manifest.</param>
215
262
/// <param name="knownTypesProvider">Type implementing <see cref="IKnownTypesProvider"/> to be used to determine a list of types implicitly known by all cooperating serializer.</param>
216
263
/// <exception cref="ArgumentException">Raised when `known-types-provider` type doesn't implement <see cref="IKnownTypesProvider"/> interface.</exception>
/// Creates a new instance of a <see cref="HyperionSerializerSettings"/>.
271
+
/// </summary>
272
+
/// <param name="preserveObjectReferences">Flag which determines if serializer should keep track of references in serialized object graph.</param>
273
+
/// <param name="versionTolerance">Flag which determines if field data should be serialized as part of type manifest.</param>
274
+
/// <param name="knownTypesProvider">Type implementing <see cref="IKnownTypesProvider"/> to be used to determine a list of types implicitly known by all cooperating serializer.</param>
0 commit comments