public async Task <bool> PutMessageIfNotDuplicateAsync(ChatMessageRow row) { var putReq = new PutItemRequest() { TableName = this.tableName, Item = ToAttributeValueMap(row), ConditionExpression = "attribute_not_exists(messageId)", }; try { await this.ddb.PutItemAsync(putReq); } catch (ConditionalCheckFailedException cex) { return(false); } return(true); }
public async Task UpdateChatMessageAsync(ChatMessageRow row) => await this.context.SaveAsync(row, this.config);
private Dictionary <string, AttributeValue> ToAttributeValueMap(ChatMessageRow row) => this.context.ToDocument(row).ToAttributeMap();