简体   繁体   English

使用 C# .NET Core 2.1 查询 DynamoDB GSI 时出错

[英]Error when Querying DynamoDB GSI Using C# .NET Core 2.1

I am getting the following error for the code below:我收到以下代码的以下错误:

Error CS1061 'AsyncSearch' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'AsyncSearch' could be found (are you missing a using directive or an assembly reference?错误 CS1061“AsyncSearch”不包含“GetAwaiter”的定义,并且找不到接受“AsyncSearch”类型的第一个参数的可访问扩展方法“GetAwaiter”(是否缺少 using 指令或程序集引用?

DynamoDBContext context = new DynamoDBContext(client);

                DynamoDBOperationConfig indexHashRangeOpConfig = new DynamoDBOperationConfig()
                {
                    IndexName = "ProjectFGDIndex",
                    ConsistentRead = false,
                };

                IEnumerable<Dashboardreq> list = await
                context.QueryAsync<Dashboardreq>(req.ProjectName, QueryOperator.Between, new string[] {
                                                 req.FileGeneratedFromDate+" " + Constants.DayBeginTime,
                                                 req.FileGeneratedToDate+" " + Constants.DayEndTime
                                                 });

The error occurs in the await context.QueryAsync call.错误发生在 await context.QueryAsync 调用中。 Looking for guidance...寻求指导...

I resolved the issue ny making the following changes to the code:我通过对代码进行以下更改解决了问题:

List<Dashboardreq> list =
                await context.QueryAsync<Dashboardreq>(req.ProjectName, QueryOperator.Between, new string[] {
                                                 req.FileGeneratedFromDate+" " + Constants.DayBeginTime,
                                                 req.FileGeneratedToDate+" " + Constants.DayEndTime
                                                 }, indexHashRangeOpConfig).GetRemainingAsync();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM