Skip to content

Class DataBase

Namespace: Tool.Sockets.NetFrame
Assembly: Tool.Net.dll

提供的唯一数据包接口类,必须实现

csharp
public abstract class DataBase : IDisposable

Inheritance

objectDataBase

Implements

IDisposable

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

消息接收的字节流数据

csharp
public ArraySegment<byte> Array { get; }

Property Value

ArraySegment<byte>

Bytes

消息接收的字节流数据

csharp
public Span<byte> Bytes { get; }

Property Value

Span<byte>

Form

发送的参数

csharp
public IReadOnlyDictionary<string, string> Form { get; }

Property Value

IReadOnlyDictionary<string, string>

IPEndPoint

数据交互的方

csharp
public Ipv4Port IPEndPoint { get; }

Property Value

Ipv4Port

IsReply

是否需要有回复消息

csharp
public bool IsReply { get; }

Property Value

bool

MemoryBytes

消息接收的字节流数据

csharp
public Memory<byte> MemoryBytes { get; }

Property Value

Memory<byte>

OnlyID

消息ID

csharp
public string OnlyID { get; }

Property Value

string

OnlyId

消息ID

csharp
public Guid OnlyId { get; }

Property Value

Guid

Methods

Dispose()

用于开发者重写的回收(可回收使用的非托管资源)

csharp
protected virtual void Dispose()

Initialize(DataNet)

当消息真实有效时被执行,默认返回执行。(该方法是用于给使用者重写的)

csharp
protected virtual bool Initialize(DataNet dataTcp)

Parameters

dataTcp DataNet

调用方法信息

Returns

bool

Json(object)

完成结果,返回Json格式数据

csharp
public IGoOut Json(object json)

Parameters

json object

Json格式数据

Returns

IGoOut

JsonAsync(object)

完成结果,返回Json格式数据

csharp
public Task<IGoOut> JsonAsync(object json)

Parameters

json object

Json格式数据

Returns

Task<IGoOut>

NetException(Exception)

当前API消息发生异常时触发

csharp
protected virtual void NetException(Exception ex)

Parameters

ex Exception

异常信息

Ok()

默认完成结果

csharp
public IGoOut Ok()

Returns

IGoOut

Ok(string, ArraySegment<byte>)

完成结果,并输出类容

csharp
public IGoOut Ok(string text, ArraySegment<byte> bytes)

Parameters

text string

文本类容

bytes ArraySegment<byte>

字节流类容

Returns

IGoOut

OkAsync()

默认完成结果

csharp
public Task<IGoOut> OkAsync()

Returns

Task<IGoOut>

OkAsync(string, ArraySegment<byte>)

完成结果,并输出类容

csharp
public Task<IGoOut> OkAsync(string text, ArraySegment<byte> bytes)

Parameters

text string

文本类容

bytes ArraySegment<byte>

字节流类容

Returns

Task<IGoOut>

Write(string)

完成结果,并输出文本类容

csharp
public IGoOut Write(string text)

Parameters

text string

文本类容

Returns

IGoOut

Write(ArraySegment<byte>)

完成结果,并输出字节流类容

csharp
public IGoOut Write(ArraySegment<byte> bytes)

Parameters

bytes ArraySegment<byte>

字节流类容

Returns

IGoOut

WriteAsync(string)

完成结果,并输出文本类容

csharp
public Task<IGoOut> WriteAsync(string text)

Parameters

text string

文本类容

Returns

Task<IGoOut>

WriteAsync(ArraySegment<byte>)

完成结果,并输出字节流类容

csharp
public Task<IGoOut> WriteAsync(ArraySegment<byte> bytes)

Parameters

bytes ArraySegment<byte>

字节流类容

Returns

Task<IGoOut>

基于Apache-2.0协议开源