C# Класс Amazon.DynamoDBv2.Model.ExpectedAttributeValue

Represents a condition to be compared with an attribute value. This condition can be used with DeleteItem, PutItem or UpdateItem operations; if the comparison evaluates to true, the operation succeeds; if not, the operation fails. You can use ExpectedAttributeValue in one of two different ways:
  • Use AttributeValueList to specify one or more values to compare against an attribute. Use ComparisonOperator to specify how you want to perform the comparison. If the comparison evaluates to true, then the conditional operation succeeds.

  • Use Value to specify a value that DynamoDB will compare against an attribute. If the values match, then ExpectedAttributeValue evaluates to true and the conditional operation succeeds. Optionally, you can also set Exists to false, indicating that you do not expect to find the attribute value in the table. In this case, the conditional operation succeeds only if the comparison evaluates to false.

Value and Exists are incompatible with AttributeValueList and ComparisonOperator. Note that if you use both sets of parameters at once, DynamoDB will return a ValidationException exception.

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
ExpectedAttributeValue ( ) : System

Empty constructor used to set properties independently even when a simple constructor is available

ExpectedAttributeValue ( AttributeValue value ) : System

Instantiates ExpectedAttributeValue with the parameterized properties

ExpectedAttributeValue ( bool exists ) : System

Instantiates ExpectedAttributeValue with the parameterized properties

Приватные методы

Метод Описание
IsSetAttributeValueList ( ) : bool
IsSetComparisonOperator ( ) : bool
IsSetExists ( ) : bool
IsSetValue ( ) : bool

Описание методов

ExpectedAttributeValue() публичный Метод

Empty constructor used to set properties independently even when a simple constructor is available
public ExpectedAttributeValue ( ) : System
Результат System

ExpectedAttributeValue() публичный Метод

Instantiates ExpectedAttributeValue with the parameterized properties
public ExpectedAttributeValue ( AttributeValue value ) : System
value AttributeValue Sets the ExpectedAttributeValue Value property
Результат System

ExpectedAttributeValue() публичный Метод

Instantiates ExpectedAttributeValue with the parameterized properties
public ExpectedAttributeValue ( bool exists ) : System
exists bool Causes DynamoDB to evaluate the value before attempting a conditional operation:
  • If Exists is true, DynamoDB will check to see if that attribute value already exists in the table. If it is found, then the operation succeeds. If it is not found, the operation fails with a ConditionalCheckFailedException.
  • If Exists is false, DynamoDB assumes that the attribute value does not exist in the table. If in fact the value does not exist, then the assumption is valid and the operation succeeds. If the value is found, despite the assumption that it does not exist, the operation fails with a ConditionalCheckFailedException.
The default setting for Exists is true. If you supply a Value all by itself, DynamoDB assumes the attribute exists: You don't have to set Exists to true, because it is implied. DynamoDB returns a ValidationException if:
  • Exists is true but there is no Value to check. (You expect a value to exist, but don't specify what that value is.)
  • Exists is false but you also provide a Value. (You cannot expect an attribute to have a value, while also expecting it not to exist.)
Результат System