title: How to use QueryAsync and ScanAsync in DynamoDB AWS C# SDk?
body: <p>I'm trying to use the QueryAsync function of the AWS C# SDK, this is my code:</p>
  <pre><code>var request = new QueryRequest
  {
      TableName = &quot;happy-projects&quot;,
      KeyConditionExpression = &quot;PK = :PK and SK = :SK&quot;,
      ExpressionAttributeValues = new Dictionary&lt;string, AttributeValue&gt; 
      {
          {&quot;:PK&quot;, new AttributeValue { S =  &quot;ORG#prueba2&quot; }},
          {&quot;:SK&quot;, new AttributeValue { S = &quot;EMP#prueba2&quot; }}
      }
  };
      
  var res = context.QueryAsync&lt;DataModelSchema&gt;(request).GetRemainingAsync().GetAwaiter().GetResult();
      
  Console.WriteLine(res);
  </code></pre>
  <p>After the code is ran it showing to me this message :</p>
  <blockquote>
  <p>System.InvalidCastException: 'Unable to cast object of type 'Amazon.DynamoDBv2.Model.QueryRequest' to type 'System.String'.'</p>
  </blockquote>
  <p>I'm currently using <code>.Net Core 3.1</code> and the <code>AWS</code> DynamoDB SDk.</p>
  <p>I'm currently using .Net Core 3.1 and the AWS DynamoDB SDk.</p>
  <p>This is my context declaration:</p>
  <pre><code>public static IAmazonDynamoDB client;
  client = new AmazonDynamoDBClient(RegionEndpoint.USWest2);
  DynamoDBContext context = new DynamoDBContext(client);
  </code></pre>
  <p>and this is my DataModelSchema class:</p>
  <pre><code>namespace DynamoDB
  {
      [DynamoDBTable(&quot;happy-projects&quot;)]
      public class DataModelSchema
      {
          [DynamoDBHashKey]
          public string PK { get; set; }
  
          [DynamoDBRangeKey(&quot;SK&quot;)]
          public string SK { get; set; }
  
          [DynamoDBProperty(&quot;name&quot;)]
          public string name { get; set; }
  
          [DynamoDBProperty(&quot;email&quot;)]
          public string email { get; set; }
  
          [DynamoDBProperty(&quot;Data&quot;)]
          public string Data { get; set; }
  
          public override string ToString()
          {
              return string.Format(&quot;{0} - {1}&quot;, name, email);
          }
      }
  }
  </code></pre>
  <p>This is the full error message:</p>
  <pre><code>System.InvalidCastException
    HResult=0x80004002
    Message=Unable to cast object of type 'Amazon.DynamoDBv2.Model.QueryRequest' to type 'System.String'.
    Source=AWSSDK.DynamoDBv2
    StackTrace:
     at Amazon.DynamoDBv2.Converter`1.TryTo(Object value, Primitive&amp; p)
     at Amazon.DynamoDBv2.Converter.TryToEntry(Object value, DynamoDBEntry&amp; entry)
     at Amazon.DynamoDBv2.Converter.ToEntry(Object value)
     at Amazon.DynamoDBv2.DynamoDBEntryConversion.ConvertToEntry(Type inputType, Object value)
     at Amazon.DynamoDBv2.DataModel.DynamoDBContext.ToDynamoDBEntry(SimplePropertyStorage propertyStorage, Object value, DynamoDBFlatConfig flatConfig, Boolean canReturnScalarInsteadOfList)
     at Amazon.DynamoDBv2.DataModel.DynamoDBContext.ToDynamoDBEntry(SimplePropertyStorage propertyStorage, Object value, DynamoDBFlatConfig flatConfig)
     at Amazon.DynamoDBv2.DataModel.DynamoDBContext.ValueToDynamoDBEntry(PropertyStorage propertyStorage, Object value, DynamoDBFlatConfig flatConfig)
     at Amazon.DynamoDBv2.DataModel.DynamoDBContext.ComposeQueryFilter(DynamoDBFlatConfig currentConfig, Object hashKeyValue, IEnumerable`1 conditions, ItemStorageConfig storageConfig, List`1&amp; indexNames)
     at Amazon.DynamoDBv2.DataModel.DynamoDBContext.ConvertQueryByValue[T](Object hashKeyValue, IEnumerable`1 conditions, DynamoDBOperationConfig operationConfig, ItemStorageConfig storageConfig)
     at Amazon.DynamoDBv2.DataModel.DynamoDBContext.QueryAsync[T](Object hashKeyValue, DynamoDBOperationConfig operationConfig)
     at DynamoDB.DataModel.RunDataModel() in \DynamoDB\DynamoDB\DataModel.cs:line 80
     at DynamoDB.Program.Main(String[] args) in DynamoDB\DynamoDB\Program.cs:line 17
  </code></pre>