Class TransactConditionCheck
Requires a condition on an item that the transaction does not modify, as part of a TransactWriteItemsRequest.
Named ConditionCheck in the DynamoDB service model.
public sealed record TransactConditionCheck : IEquatable<TransactConditionCheck>
- Inheritance
-
TransactConditionCheck
- Implements
- Inherited Members
Remarks
Use it to make a write depend on another item, for example to write an order only while the customer exists. Another action of the same transaction cannot target the checked item.
Constructors
TransactConditionCheck()
public TransactConditionCheck()
Properties
ConditionExpression
Gets the condition that must hold, for example "attribute_exists(pk) AND #s = :active". When it does not hold, the
whole transaction is cancelled and the reason for this action is ConditionalCheckFailed. A missing item satisfies only
conditions such as attribute_not_exists(...).
Attribute names that are DynamoDB reserved words, such as name, status, size, order or total,
must be aliased with a #placeholder defined in ExpressionAttributeNames; written directly, DynamoDB rejects the
request with a ValidationException. See the list of reserved words.
public required string ConditionExpression { get; init; }
Property Value
ExpressionAttributeNames
Gets the substitutions for #name placeholders in ConditionExpression.
Use it to alias attribute names that are DynamoDB reserved words, such as name, status, size, order or
total, which DynamoDB rejects with a ValidationException when an expression uses them directly (the check is
case-insensitive), and names with a dot or other special characters. See the list of reserved words.
public IReadOnlyDictionary<string, string>? ExpressionAttributeNames { get; init; }
Property Value
ExpressionAttributeValues
Gets the substitutions for :value placeholders in ConditionExpression.
public IReadOnlyDictionary<string, AttributeValue>? ExpressionAttributeValues { get; init; }
Property Value
Key
Gets the full primary key of the item to check: the partition key and, if the table has one, the sort key.
public required IReadOnlyDictionary<string, AttributeValue> Key { get; init; }
Property Value
ReturnValuesOnConditionCheckFailure
Gets whether a failed condition returns the existing item in Item.
public ReturnValuesOnConditionCheckFailure ReturnValuesOnConditionCheckFailure { get; init; }
Property Value
TableName
Gets the table name (or table ARN).
public required string TableName { get; init; }
Property Value
Methods
Equals(TransactConditionCheck?)
public bool Equals(TransactConditionCheck? other)
Parameters
otherTransactConditionCheck
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 ==(TransactConditionCheck?, TransactConditionCheck?)
public static bool operator ==(TransactConditionCheck? left, TransactConditionCheck? right)
Parameters
leftTransactConditionCheckrightTransactConditionCheck
Returns
operator !=(TransactConditionCheck?, TransactConditionCheck?)
public static bool operator !=(TransactConditionCheck? left, TransactConditionCheck? right)
Parameters
leftTransactConditionCheckrightTransactConditionCheck