Table of Contents

Class ChangeRecord

Namespace
DynaSharp.Streams
Assembly
DynaSharp.dll

One change to an item of a table, as a stream delivers it.

public sealed record ChangeRecord : IEquatable<ChangeRecord>
Inheritance
ChangeRecord
Implements
Inherited Members

Remarks

Each change appears in the stream exactly once and in the order of the changes to that item, but changes to different items may come in any order, and a reader that restarts from an older position sees records again. Process records idempotently.

Constructors

ChangeRecord()

public ChangeRecord()

Properties

DynamoDb

Gets the change itself (dynamodb on the wire). DynamoDB sends it with every record: null only if the response omits it.

public StreamRecord? DynamoDb { get; init; }

Property Value

StreamRecord

EventId

Gets the identifier of the record, unique within the stream (eventID on the wire). DynamoDB sends it with every record: null only if the response omits it.

public string? EventId { get; init; }

Property Value

string

EventName

Gets the kind of change (eventName on the wire).

public OperationType EventName { get; init; }

Property Value

OperationType

EventSource

Gets the source of the event: aws:dynamodb (eventSource on the wire). DynamoDB sends it with every record: null only if the response omits it.

public string? EventSource { get; init; }

Property Value

string

EventVersion

Gets the version of the record format, for example 1.1 (eventVersion on the wire). DynamoDB sends it with every record: null only if the response omits it.

public string? EventVersion { get; init; }

Property Value

string

Region

Gets the name of the region the change was made in (awsRegion on the wire). DynamoDB sends it with every record: null only if the response omits it.

public string? Region { get; init; }

Property Value

string

UserIdentity

Gets who made the change (userIdentity on the wire). Only set for changes DynamoDB made itself: a deletion by Time to Live has PrincipalId dynamodb.amazonaws.com and Type Service. null for changes made by a client.

public RecordIdentity? UserIdentity { get; init; }

Property Value

RecordIdentity

Methods

As<T>()

Reads the change as a change of a T, from its images: if (record.As<Order>() is { } order) { }. A table of several entities streams all of them, so a reader asks for each type it handles, As<Customer>() after As<Order>().

public Change<T>? As<T>() where T : IDynamoDbEntity<T>

Returns

Change<T>

The change, or null when neither image is a T, or the record has no DynamoDb.

Type Parameters

T

The entity.

Remarks

An image is a T when its discriminator attribute holds the discriminator of the entity, as Is<T>() tests; an entity without a discriminator, [Discriminator(OptOut = true)], takes every image. An image that is one is read as To<T>() reads it.

An item whose type changed at its key, an old image of another type than the new one, is a removal of the old type and an insert of the new one: As<Order>() gives Remove with Before, and As<Invoice>() Insert with After. Which images there are depends on the view of the stream, see Change<T>: under KeysOnly the result is always null.

Exceptions

DynamoDbMappingException

An image that is a T cannot be read as one, with Key the keys of the record. An item of the entity that does not fit it is a bug of the model or of a writer, as on a read of the table.

Equals(ChangeRecord?)

public bool Equals(ChangeRecord? other)

Parameters

other ChangeRecord

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

Operators

operator ==(ChangeRecord?, ChangeRecord?)

public static bool operator ==(ChangeRecord? left, ChangeRecord? right)

Parameters

left ChangeRecord
right ChangeRecord

Returns

bool

operator !=(ChangeRecord?, ChangeRecord?)

public static bool operator !=(ChangeRecord? left, ChangeRecord? right)

Parameters

left ChangeRecord
right ChangeRecord

Returns

bool