Protobuf.net NetworkComms V3 serializer sum JSONSerializer

NetworkComms v3 release, the default is protobuf.net serializer.

That is, when you do not specify a sequence of time, the system automatically uses the default protobuf.net serializer.

Of course, we can also specify your own serializer

The syntax is as follows:

SendReceiveOptions aboveOptions = new SendReceiveOptions (DPSManager.GetDataSerializer < ProtobufSerializer> (), null, null);
using the class protobuf.net transmission needs to be added protobuf related attribute, as follows.

If the transfer class, sql entity class data table corresponding to the profile can be generated using template matching CodeSmith network communication framework template NetworkComms


using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using ProtoBuf;
using EEDocManage.Data;

namespace EEDocManage.Business
{
[ProtoContract]
public class Dep
{

#region Constructors

public Dep()
{ }


#endregion

#region Private Properties

private int iD = -1;
private string title = string.Empty;

#endregion

#region Public Properties

[ProtoMember(1)]
public int ID
{
get { return iD; }
set { iD = value; }
}
[ProtoMember(2)]
public string Title
{
get { return title; }
set { title = value; }
}

#endregion

 


}

}

 

NeworkComms V3 framework also customize the JSONSerializer serializer (support .net Framework 4.0 version)

Use words enough to specify serializer can

SendReceiveOptions aboveOptions = new SendReceiveOptions (DPSManager.GetDataSerializer < JSONSerializer> (), null, null);
specific other settings, because I was not too understanding of json, being explored

www.networkComms.cn finishing
---------------------
Author: networkcomms
Source: CSDN
Original: https: //blog.csdn.net/networkcomms/article/details / 44218197
copyright: This article is a blogger original article, reproduced, please attach Bowen link!

Guess you like

Origin www.cnblogs.com/Jeely/p/10972223.html