Class ChangeRecord
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
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
EventName
Gets the kind of change (eventName on the wire).
public OperationType EventName { get; init; }
Property Value
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
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
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
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
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
Type Parameters
TThe 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
Tcannot 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
otherChangeRecord
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(ChangeRecord?, ChangeRecord?)
public static bool operator ==(ChangeRecord? left, ChangeRecord? right)
Parameters
leftChangeRecordrightChangeRecord
Returns
operator !=(ChangeRecord?, ChangeRecord?)
public static bool operator !=(ChangeRecord? left, ChangeRecord? right)
Parameters
leftChangeRecordrightChangeRecord