gpt4 book ai didi

c#-4.0 - 使用全局二级索引的 .net queryAsync 方法的 AWS sdk 失败

转载 作者:行者123 更新时间:2023-12-01 01:26:35 26 4
gpt4 key购买 nike

下面给出的是我用来从 Dynamodb 表中检索详细信息的方法。但是当我调用这个方法时,它最终抛出了一个异常“无法找到关键属性任命 ID 的属性”。这个特定表的主键是appointmentId,但我已经在patientId 列上创建了一个全局二级索引。我在下面的查询中使用该索引来获取给定患者 ID 的约会详细信息。

public async Task GetAppointmentByPatientID(int patientID)
{
var context = CommonUtils.Instance.DynamoDBContext;


PatientAppointmentObjectList.Clear();


DynamoDBOperationConfig config = new DynamoDBOperationConfig();
config.IndexName = DBConstants.APPOINTMENT_PATIENTID_GSI;
AsyncSearch<ScheduledAppointment> appQuery = context.QueryAsync<ScheduledAppointment>(patientID.ToString(), config);
IEnumerable<ScheduledAppointment> appList = await appQuery.GetRemainingAsync();

appList.Distinct().ToList().ForEach(i => PatientAppointmentObjectList.Add(i));

if (PropertyChanged != null)
this.OnPropertyChanged("PatientAppointmentObjectList");
}
}

最佳答案

这是一个愚蠢的错误。我已经将表的哈希键列作为“appointmentID”,并将模型对象属性命名为 AppointmentID。属性名称的不匹配混淆了 dynamodb 映射。

关于c#-4.0 - 使用全局二级索引的 .net queryAsync 方法的 AWS sdk 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31963166/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com