Amazon.DynamoDBv2.DocumentModel.Table.Scan C# (CSharp) Method

Scan() public method

Initiates a Search object to Scan a DynamoDB table, with the specified expression. No calls are made until the Search object is used.
public Scan ( Amazon.DynamoDBv2.DocumentModel.Expression filterExpression ) : Search
filterExpression Amazon.DynamoDBv2.DocumentModel.Expression Expression to apply to the scan.
return Search
        public Search Scan(Expression filterExpression)
        {
            ScanOperationConfig config = new ScanOperationConfig
            {
                FilterExpression = filterExpression
            };

            return Scan(config);
        }

Same methods

Table::Scan ( ScanFilter filter ) : Search
Table::Scan ( ScanOperationConfig config ) : Search

Usage Example

Ejemplo n.º 1
0
        public static List <Document> GetAllDocumentsWithFilter(string tableName, string columnName, string filterValue)
        {
            try
            {
                AmazonDynamoDBClient client = new AmazonDynamoDBClient(MyAWSConfigs.DynamodbRegion);

                Table table = Table.LoadTable(client, tableName);

                ScanFilter scanFilter = new ScanFilter();
                scanFilter.AddCondition(columnName, ScanOperator.Equal, filterValue);

                Search          search = table.Scan(scanFilter);
                List <Document> docs   = new List <Document>();
                do
                {
                    docs.AddRange(search.GetNextSet().ToList <Document>());
                } while (!search.IsDone);

                var temp = docs.ToList <Document>();

                client.Dispose();

                return(temp);
            }
            catch (AmazonDynamoDBException e)
            {
                Console.WriteLine("AmazonDynamoDBException: " + e);
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: " + e);
            }

            return(null);
        }