I am trying to add an item to DynamoDB only if it doesn't exist already. I have tried the below code and doesn't look like the query filter is being applied for SaveAsync. I don't get an exception even when an item with the primary key (CommentId, CommentType) already exists.
public Task Add(Comment comment)
{
var config = new DynamoDBOperationConfig();
var partitionKeyCondition = new ScanCondition("CommentId", ScanOperator.NotEqual, 1);
var rangeKeyCondition = new ScanCondition("CommentType", ScanOperator.NotEqual, "UserComment");
config.QueryFilter.Add(partitionKeyCondition);
config.QueryFilter.Add(rangeKeyCondition);
return DynamoDBContext.SaveChangesAsync(comment, config);
}