ZayniFramework.Serialization
2.3.2
See the version list below for details.
dotnet add package ZayniFramework.Serialization --version 2.3.2
NuGet\Install-Package ZayniFramework.Serialization -Version 2.3.2
<PackageReference Include="ZayniFramework.Serialization" Version="2.3.2" />
paket add ZayniFramework.Serialization --version 2.3.2
#r "nuget: ZayniFramework.Serialization, 2.3.2"
// Install ZayniFramework.Serialization as a Cake Addin #addin nuget:?package=ZayniFramework.Serialization&version=2.3.2 // Install ZayniFramework.Serialization as a Cake Tool #tool nuget:?package=ZayniFramework.Serialization&version=2.3.2
Serialization module example.
Add namespace using.
using ZayniFramework.Common;
using ZayniFramework.Serialization;
Using ISerializer and SerializerFactory to serialize and deserialize.
var model = new UserModel()
{
Name = "Kate",
Birthday = new DateTime( 1998, 2, 14, 15, 24, 36 ).AddMilliseconds( 257 ),
Sex = 0
};
// Using JsonNetSerializer.
var serializer = SerializerFactory.Create( "Json.NET" );
var 5 = serializer.Serialize( model ) + "";
var d1 = serializer.Deserialize<UserModel>( 5 );
// Using JilSerializer.
var serializer2 = SerializerFactory.Create( "Jil" );
var s2 = serializer2.Serialize( model ) + "";
var d2 = serializer2.Deserialize<UserModel>( s2 );
// Using XmlSerializer.
var serializer3 = SerializerFactory.Create( "XML" );
var s3 = serializer3.Serialize( model ) + "";
var d3 = serializer3.Deserialize<UserModel>( s3 );
// Using BinaryFormatSerializer.
var serializer4 = SerializerFactory.Create( "BinaryFormatter" );
var s4 = serializer4.Serialize( model ) + "";
var d4 = serializer4.Deserialize<UserModel>( s4 );
// Using ZeroFormatSerializer.
// ZeroFormatter serialize and deserialize is SUPER FAST... But you have to pay the price for it like this...
// 如果要使用 ZeroFormatter 進行無敵快的序列化和反序列化,使用起來就會失去一些彈性... 沒辦法,要快,要付出某些架構上的代價...
var serializer5 = (ZeroFormatSerializer)SerializerFactory.Create( "ZeroFormatter" );
var s5 = serializer5.SerializeObject<UserModel>( model );
var d5 = serializer5.Deserialize<UserModel>( s5 );
You can even define your own ISerializer and register it into SerializerFactory.
/// <summary>You customer Serializer implementation class
/// </summary>
public class YourSerializer : ISerializer
{
/// <summary>How to deserialize here...
/// </summary>
/// <typeparam name="TResult"></typeparam>
/// <param name="obj"></param>
/// <returns></returns>
public TResult Deserialize<TResult>( object obj ) => default ( TResult );
/// <summary>How to serialize here...
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public object Serialize( object obj ) => "AAA";
}
And then, you can register your YourSerializer into SerializerFactory like this:
var name = "YourSerializer";
var r = SerializerFactory.Register( name, new YourSerializer() );
Assert.IsTrue( r.IsSuccess );
var serializer = SerializerFactory.Create( name );
Assert.IsNotNull( serializer );
var s = serializer.Serialize( new object() );
Assert.AreEqual( "AAA", s );
The JsonConvertUtil Serialize sample.
var model = new UserModel()
{
Name = "Test",
Birthday = new DateTime( 1998, 2, 14, 15, 24, 36 ),
Sex = 0
};
string json = JsonConvertUtil.SerializeInCamelCase( model, false );
The JsonConvertUtil Deserialize sample.
UserModel obj = JsonConvertUtil.DeserializeFromCamelCase<UserModel>( json, false );
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Jil (>= 2.17.0)
- Newtonsoft.Json (>= 12.0.1)
- ZayniFramework.Common (>= 2.3.2)
- ZeroFormatter (>= 1.6.4)
NuGet packages (12)
Showing the top 5 NuGet packages that depend on ZayniFramework.Serialization:
Package | Downloads |
---|---|
ZayniFramework.Middle.Service.Entity
The Middle.ServiceHost.Entity define the entities and DTOs for Middle.ServiceHost and Middle.ServiceHost.Client module. GitLab Repository: https://gitlab.com/ponylin1985/zayniframework |
|
ZayniFramework.DataAccess
This is a lightweight ORM framework like Dapper but also provider DbCommand SQL log. Support Microsoft SQL Server, MySQL, PostgreSQL and Oracle database. Also support dynamic ORM. GitLab Repository: https://gitlab.com/ponylin1985/zayniframework |
|
ZayniFramework.Middle.Service
The Middle.Service module provide a self-hosted .NET middleware framework to separate the communication protocol detail with your business logic code. You can use it to build the backend microservices easier. Support TCPSocket, WebSocket and RabbitMQ protocol. You can also implement the IRemoteHost interface and register it into the Middle.Service module as an extension module for this middleware framework. Have a nice day... :) GitLab Repository: https://gitlab.com/ponylin1985/zayniframework |
|
ZayniFramework.Middle.Service.Client
The Middle.Service.Client is the client SDK for Middle.Service module. You can use it to connect, send RPC request or publish message to the server side's service host very easy. Support TCPSocket, WebSocket and RabbitMQ protocol. GitLab Repository: https://gitlab.com/ponylin1985/zayniframework |
|
ZayniFramework.Middle.Service.Grpc
This is an extension module for Zayni Framework's Middle.Service module. This extension module provide the gRPC RemoteHost service implementation for Middle.Service module. GitLab Repository: https://gitlab.com/ponylin1985/zayniframework |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.0.142 | 389 | 3/19/2024 |
8.0.141 | 328 | 1/4/2024 |
8.0.140 | 380 | 12/17/2023 |
6.0.138 | 387 | 3/19/2024 |
6.0.137 | 801 | 9/20/2023 |
6.0.136 | 727 | 9/14/2023 |
6.0.135 | 744 | 9/10/2023 |
6.0.134 | 934 | 7/12/2023 |
6.0.133 | 875 | 7/10/2023 |
6.0.132 | 892 | 7/7/2023 |
6.0.131 | 933 | 6/19/2023 |
6.0.130 | 927 | 6/19/2023 |
6.0.129 | 12,636 | 7/2/2022 |
6.0.128 | 2,869 | 1/16/2022 |
6.0.127 | 2,915 | 1/15/2022 |
6.0.126 | 2,925 | 1/15/2022 |
6.0.125 | 1,627 | 1/8/2022 |
6.0.125-hotfix1 | 847 | 1/8/2022 |
6.0.124 | 1,628 | 1/7/2022 |
6.0.123 | 1,910 | 11/14/2021 |
5.0.129 | 3,663 | 7/2/2022 |
5.0.128 | 3,974 | 1/16/2022 |
5.0.125 | 2,044 | 1/8/2022 |
5.0.124 | 2,025 | 1/7/2022 |
5.0.123 | 2,497 | 11/14/2021 |
5.0.122 | 2,753 | 10/11/2021 |
5.0.121 | 2,795 | 5/1/2021 |
3.1.137 | 1,351 | 9/20/2023 |
3.1.136 | 1,233 | 9/14/2023 |
3.1.135 | 1,374 | 9/10/2023 |
3.1.134 | 1,652 | 7/12/2023 |
3.1.133 | 1,625 | 7/11/2023 |
3.1.132 | 1,636 | 7/8/2023 |
3.1.131 | 1,712 | 6/19/2023 |
3.1.130 | 3,095 | 2/1/2023 |
3.1.129 | 5,529 | 7/2/2022 |
3.1.128 | 5,691 | 1/16/2022 |
3.1.125 | 3,043 | 1/8/2022 |
3.1.124 | 2,985 | 1/7/2022 |
3.1.123 | 3,692 | 11/14/2021 |
3.1.122 | 4,164 | 10/11/2021 |
3.1.121 | 4,280 | 5/1/2021 |
2.31.120 | 2,812 | 3/14/2021 |
2.30.115 | 6,391 | 3/6/2021 |
2.30.114 | 2,687 | 3/6/2021 |
2.20.101 | 3,408 | 3/1/2021 |
2.19.3 | 2,804 | 2/11/2021 |
2.19.2 | 15,107 | 2/6/2021 |
2.19.1 | 3,113 | 1/6/2021 |
2.19.0 | 3,142 | 1/1/2021 |
2.18.3 | 5,283 | 12/27/2020 |
2.18.2 | 6,337 | 8/29/2020 |
2.18.1 | 9,465 | 8/26/2020 |
2.18.0 | 9,694 | 8/20/2020 |
2.17.135 | 5,412 | 8/19/2020 |
2.17.134 | 9,652 | 7/28/2020 |
2.17.133 | 5,410 | 7/27/2020 |
2.17.132 | 5,342 | 7/18/2020 |
2.17.131 | 5,707 | 7/11/2020 |
2.16.130 | 5,324 | 6/13/2020 |
2.15.128 | 5,496 | 6/3/2020 |
2.15.127 | 5,400 | 5/31/2020 |
2.15.126 | 6,664 | 4/30/2020 |
2.14.122 | 5,089 | 4/13/2020 |
2.13.100 | 5,448 | 3/12/2020 |
2.12.51 | 5,391 | 2/18/2020 |
2.11.50 | 12,393 | 2/10/2020 |
2.10.44 | 14,103 | 1/30/2020 |
2.9.43 | 13,851 | 1/11/2020 |
2.8.42 | 14,180 | 1/10/2020 |
2.8.41 | 13,943 | 1/5/2020 |
2.7.40 | 13,695 | 1/2/2020 |
2.7.39 | 13,745 | 1/2/2020 |
2.7.38 | 14,260 | 1/1/2020 |
2.6.37 | 13,945 | 12/23/2019 |
2.6.35 | 14,078 | 12/4/2019 |
2.6.1 | 13,958 | 12/2/2019 |
2.6.0 | 13,828 | 11/28/2019 |
2.5.2 | 14,433 | 11/26/2019 |
2.5.1 | 13,845 | 11/12/2019 |
2.5.0 | 13,765 | 11/9/2019 |
2.4.3 | 12,349 | 10/16/2019 |
2.4.2 | 11,233 | 10/16/2019 |
2.4.1 | 11,448 | 9/20/2019 |
2.3.113 | 2,696 | 3/6/2021 |
2.3.112 | 2,628 | 3/6/2021 |
2.3.28 | 11,798 | 9/19/2019 |
2.3.27 | 11,679 | 8/30/2019 |
2.3.26 | 12,053 | 8/20/2019 |
2.3.25 | 11,514 | 8/12/2019 |
2.3.22 | 12,033 | 7/31/2019 |
2.3.21 | 12,115 | 7/20/2019 |
2.3.20 | 11,140 | 6/22/2019 |
2.3.19 | 11,695 | 6/14/2019 |
2.3.18 | 12,205 | 6/13/2019 |
2.3.17 | 11,652 | 6/13/2019 |
2.3.15 | 11,644 | 6/8/2019 |
2.3.14 | 11,620 | 6/8/2019 |
2.3.13 | 12,109 | 5/30/2019 |
2.3.12 | 6,194 | 5/24/2019 |
2.3.11 | 6,037 | 5/24/2019 |
2.3.10 | 6,381 | 5/21/2019 |
2.3.9 | 6,035 | 5/9/2019 |
2.3.8 | 6,333 | 5/8/2019 |
2.3.7 | 6,361 | 4/30/2019 |
2.3.6 | 6,347 | 4/23/2019 |
2.3.5 | 6,245 | 4/19/2019 |
2.3.4 | 6,038 | 4/18/2019 |
2.3.3 | 5,970 | 4/17/2019 |
2.3.2 | 6,097 | 4/6/2019 |
2.3.1 | 6,169 | 12/15/2018 |
2.3.0 | 5,990 | 12/7/2018 |
2.2.7 | 850 | 12/2/2018 |
2.2.6 | 9,361 | 11/25/2018 |
2.2.1 | 15,989 | 11/17/2018 |
2.2.0 | 5,115 | 11/16/2018 |
2.1.0 | 5,063 | 11/15/2018 |
2.0.2 | 823 | 11/12/2018 |
2.0.1 | 3,506 | 11/6/2018 |
2.0.0 | 3,808 | 11/4/2018 |