Amazon.DynamoDBv2.DocumentModel.ScanFilter.AddCondition C# (CSharp) Method

AddCondition() public method

Adds a condition for a specified attribute that consists of an operator and any number of values
public AddCondition ( string attributeName, ScanOperator op ) : void
attributeName string Target attribute name
op ScanOperator Comparison operator
return void
        public void AddCondition(string attributeName, ScanOperator op, params DynamoDBEntry[] values)
        {
            AddCondition(attributeName, new Condition
            {
                ComparisonOperator = EnumToStringMapper.Convert(op),
                AttributeValueList = ConvertToAttributeValues(values)
            });
        }
    }

Same methods

ScanFilter::AddCondition ( string attributeName, ScanOperator op, List values ) : void

Usage Example

        public void CommandSubscribe() {
            Table replyTable = Table.LoadTable(client, tableName);

            Console.WriteLine("Listening to the events continuously.");

            Int64 last_key = 0;
            while (true) {
                var scan_filter = new ScanFilter();
                if (last_key > 0) {
                    scan_filter.AddCondition("K", ScanOperator.GreaterThan, last_key);
                }
                Search search = replyTable.Scan(scan_filter);

                List<Document> documentList = new List<Document>();
                do {
                    documentList = search.GetNextSet();
                    foreach (var document in documentList) {
                        Console.WriteLine("{0} : {1}", document["K"], document["V"]);
                        Int64 current_key = Int64.Parse(document["K"].AsString());
                        if (!(current_key > last_key)) {
                            Console.WriteLine("ERROR: {0} should be > {1}.", current_key, last_key);
                        }
                        else {
                            last_key = current_key;
                        }
                    }

                } while (!search.IsDone);

                // TODO(dkorolev): Do something smarter here, and wrap the whole thing into an IObservable<>.
                System.Threading.Thread.Sleep(50);
            }
        }
All Usage Examples Of Amazon.DynamoDBv2.DocumentModel.ScanFilter::AddCondition
ScanFilter