Class DataBase
Namespace: Tool.Sockets.NetFrame
Assembly: Tool.Net.dll
提供的唯一数据包接口类,必须实现
public abstract class DataBase : IDisposableInheritance
Implements
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Extension Methods
ObjectExtension.Add<T>(object, object, object), ObjectExtension.CopyEntity(object, object, params string[]), ObjectExtension.EntityToJson(object), ObjectExtension.EntityToJson(object, bool), ObjectExtension.EntityToJson(object, bool, string), DictionaryExtension.GetDictionary(object), TypeExtension.GetFieldKey(object, string, out bool), TypeExtension.GetFieldKey<T>(object, string, out bool), TypeExtension.GetFieldKey(object, Type, string, out bool), ObjectExtension.GetIntPtr(object), ObjectExtension.GetIntPtrInt(object), TypeExtension.GetPropertieFind(object, string, bool), TypeExtension.GetProperties(object), TypeExtension.GetPropertyKey(object, string, out bool), TypeExtension.GetPropertyKey<T>(object, string, out bool), TypeExtension.GetPropertyKey(object, Type, string, out bool), TypeExtension.GetValue(object, PropertyDescriptor), TypeExtension.GetValue(object, string, bool), TypeExtension.GetValue(object, string), ObjectExtension.Read<T>(object, object, int, int), ObjectExtension.Read<T>(object, int, object, int, int), DictionaryExtension.SetDictionary(object, IDictionary<string, object>), TypeExtension.SetFieldKey(object, string, object), TypeExtension.SetFieldKey<T>(object, string, object), TypeExtension.SetFieldKey(object, Type, string, object), TypeExtension.SetPropertyKey(object, string, object), TypeExtension.SetPropertyKey<T>(object, string, object), TypeExtension.SetPropertyKey(object, Type, string, object), TypeExtension.SetValue(object, PropertyDescriptor, object), TypeExtension.SetValue(object, string, object, bool), TypeExtension.SetValue(object, string, object), ObjectExtension.ToBase64String(object), ObjectExtension.ToBytes(object), ObjectExtension.ToBytes(object, out Type), DictionaryExtension.ToDictionary(object), DictionaryExtension.ToDictionary<T>(object), DictionaryExtension.ToIDictionary(object), DictionaryExtension.ToIDictionary<T>(object), ObjectExtension.ToJson(object), ObjectExtension.ToJson(object, JsonSerializerOptions), ObjectExtension.ToJsonWeb(object), ObjectExtension.ToJsonWeb(object, Action<JsonSerializerOptions>), ObjectExtension.ToTryVar<T>(object, T), ObjectExtension.ToVar<T>(object), ObjectExtension.ToVar(object, Type, bool), ObjectExtension.ToVar(object, string), ObjectExtension.ToXml(object)
Remarks
代码由逆血提供支持
Properties
Array
消息接收的字节流数据
public ArraySegment<byte> Array { get; }Property Value
Bytes
消息接收的字节流数据
public Span<byte> Bytes { get; }Property Value
Form
发送的参数
public IReadOnlyDictionary<string, string> Form { get; }Property Value
IReadOnlyDictionary<string, string>
IPEndPoint
数据交互的方
public Ipv4Port IPEndPoint { get; }Property Value
IsReply
是否需要有回复消息
public bool IsReply { get; }Property Value
MemoryBytes
消息接收的字节流数据
public Memory<byte> MemoryBytes { get; }Property Value
OnlyID
消息ID
public string OnlyID { get; }Property Value
OnlyId
消息ID
public Guid OnlyId { get; }Property Value
Methods
Dispose()
用于开发者重写的回收(可回收使用的非托管资源)
protected virtual void Dispose()Initialize(DataNet)
当消息真实有效时被执行,默认返回执行。(该方法是用于给使用者重写的)
protected virtual bool Initialize(DataNet dataTcp)Parameters
dataTcp DataNet
调用方法信息
Returns
Json(object)
完成结果,返回Json格式数据
public IGoOut Json(object json)Parameters
json object
Json格式数据
Returns
JsonAsync(object)
完成结果,返回Json格式数据
public Task<IGoOut> JsonAsync(object json)Parameters
json object
Json格式数据
Returns
NetException(Exception)
当前API消息发生异常时触发
protected virtual void NetException(Exception ex)Parameters
ex Exception
异常信息
Ok()
默认完成结果
public IGoOut Ok()Returns
Ok(string, ArraySegment<byte>)
完成结果,并输出类容
public IGoOut Ok(string text, ArraySegment<byte> bytes)Parameters
text string
文本类容
bytes ArraySegment<byte>
字节流类容
Returns
OkAsync()
默认完成结果
public Task<IGoOut> OkAsync()Returns
OkAsync(string, ArraySegment<byte>)
完成结果,并输出类容
public Task<IGoOut> OkAsync(string text, ArraySegment<byte> bytes)Parameters
text string
文本类容
bytes ArraySegment<byte>
字节流类容
Returns
Write(string)
完成结果,并输出文本类容
public IGoOut Write(string text)Parameters
text string
文本类容
Returns
Write(ArraySegment<byte>)
完成结果,并输出字节流类容
public IGoOut Write(ArraySegment<byte> bytes)Parameters
bytes ArraySegment<byte>
字节流类容
Returns
WriteAsync(string)
完成结果,并输出文本类容
public Task<IGoOut> WriteAsync(string text)Parameters
text string
文本类容
Returns
WriteAsync(ArraySegment<byte>)
完成结果,并输出字节流类容
public Task<IGoOut> WriteAsync(ArraySegment<byte> bytes)Parameters
bytes ArraySegment<byte>
字节流类容