Show / Hide Table of Contents

Interface IDataTransferObject

Represents structured data unit that can be transferred over wire.

Namespace: DotNext.IO
Assembly: DotNext.IO.dll
Syntax
public interface IDataTransferObject

Properties

| Improve this Doc View Source

IsReusable

Indicates that the content of this object can be copied to the output stream or pipe multiple times.

Declaration
bool IsReusable { get; }
Property Value
Type Description
Boolean
| Improve this Doc View Source

Length

Gets length of the object payload, in bytes.

Declaration
long? Length { get; }
Property Value
Type Description
Nullable<Int64>
Remarks

If value is null then length of the payload cannot be determined.

Methods

| Improve this Doc View Source

DecodeAsync<TResult, TDecoder>(PipeReader, TDecoder, CancellationToken)

Decodes the data using pipe reader.

Declaration
static ValueTask<TResult> DecodeAsync<TResult, TDecoder>(PipeReader input, TDecoder transformation, CancellationToken token)

    where TDecoder : IDataTransferObject.IDecoder<TResult>
Parameters
Type Name Description
PipeReader input

The pipe reader used for decoding.

TDecoder transformation

The decoder.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<TResult>

The decoded stream.

Type Parameters
Name Description
TResult

The type of result.

TDecoder

The type of parser.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

| Improve this Doc View Source

DecodeAsync<TResult, TDecoder>(Stream, TDecoder, Boolean, CancellationToken)

Decodes the stream.

Declaration
static ValueTask<TResult> DecodeAsync<TResult, TDecoder>(Stream input, TDecoder transformation, bool resetStream, CancellationToken token)

    where TDecoder : IDataTransferObject.IDecoder<TResult>
Parameters
Type Name Description
Stream input

The stream to decode.

TDecoder transformation

The decoder.

Boolean resetStream

true to reset stream position after decoding.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<TResult>

The decoded stream.

Type Parameters
Name Description
TResult

The type of result.

TDecoder

The type of parser.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

| Improve this Doc View Source

GetObjectDataAsync<TResult, TDecoder>(TDecoder, CancellationToken)

Converts data transfer object to another type.

Declaration
virtual ValueTask<TResult> GetObjectDataAsync<TResult, TDecoder>(TDecoder parser, CancellationToken token = default(CancellationToken))

    where TDecoder : IDataTransferObject.IDecoder<TResult>
Parameters
Type Name Description
TDecoder parser

The parser instance.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<TResult>

The converted DTO content.

Type Parameters
Name Description
TResult

The type of result.

TDecoder

The type of parser.

Remarks

The default implementation copies the content into memory before parsing.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

| Improve this Doc View Source

WriteToAsync<TWriter>(TWriter, CancellationToken)

Transforms this object to serialized form.

Declaration
ValueTask WriteToAsync<TWriter>(TWriter writer, CancellationToken token)

    where TWriter : IAsyncBinaryWriter
Parameters
Type Name Description
TWriter writer

The binary writer.

CancellationToken token

The toke that can be used to cancel the operation.

Returns
Type Description
ValueTask

The task representing state of asynchronous execution.

Type Parameters
Name Description
TWriter

The type of writer.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

Extension Methods

AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, CancellationToken)
ObjectExtensions.GetUserData<T>(T)
ObjectExtensions.IsOneOf<T>(T, IEnumerable<T>)
ObjectExtensions.IsOneOf<T>(T, T[])
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>)
ObjectExtensions.As<T>(T)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
DataTransferObject.WriteToAsync<TObject>(TObject, Stream, Memory<Byte>, CancellationToken)
DataTransferObject.WriteToAsync<TObject>(TObject, Stream, Int32, CancellationToken)
DataTransferObject.WriteToAsync<TObject>(TObject, PipeWriter, CancellationToken)
DataTransferObject.WriteToAsync<TObject>(TObject, IBufferWriter<Byte>, CancellationToken)
DataTransferObject.ToStringAsync<TObject>(TObject, Encoding, CancellationToken)
DataTransferObject.ToStringAsync<TObject>(TObject, Encoding, Int32, CancellationToken)
DataTransferObject.ToByteArrayAsync<TObject>(TObject, CancellationToken)
DataTransferObject.ToType<TResult, TObject>(TObject, CancellationToken)
DataTransferObject.GetObjectDataAsync<TResult, TObject>(TObject, CancellationToken)
DataTransferObject.GetObjectDataAsync<TResult, TObject>(TObject, Func<IAsyncBinaryReader, CancellationToken, ValueTask<TResult>>, CancellationToken)
ExpressionBuilder.Const<T>(T)

See Also

IAsyncBinaryReader
IAsyncBinaryWriter
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX