我按照我的理解是从 DynamoDB 数据库中提取对象时进行对象映射的正确方法。我的问题是,当我执行 DyanmoDBContext.Scan 函数时,它会抛出以下异常(如下所示)
抛出异常:AWSSDK.DynamoDBv2.dll 中的“System.InvalidOperationException”
显示为
找不到属性 [BuildingRoutes] 的存储信息
我无法理解是什么导致抛出此异常,因此实际上并未转换为我的自定义类。
下面是主要功能。
class Program
{
static void Main(string[] args)
{
// Initialize the Amazon Cognito credentials provider
CognitoAWSCredentials credentials = new CognitoAWSCredentials(
//Not showing my credentials for AWS.
);
var client = new AmazonDynamoDBClient(credentials, RegionEndpoint.USEast1);
DynamoDBContext context = new DynamoDBContext(client);
try
{
// Query a specific forum and thread.
string tableName = "BuildingRoutes";
string primaryKey = "Witmer Hall";
LowLevelQuery.Scan(tableName, primaryKey);
List<RoomsObject> building = new List<RoomsObject>();
Console.WriteLine("\n");
IEnumerable<BuildingRoutes> BuildingRoutess = LowLevelQuery.contextScan(tableName, primaryKey);
printBuilding(building);
Console.WriteLine("Example complete. To continue, press Enter");
Console.ReadLine();
}
catch (AmazonDynamoDBException e) { Console.WriteLine(e.Message); Console.ReadLine(); }
catch (AmazonServiceException e) { Console.WriteLine(e.Message); Console.ReadLine(); }
catch (Exception e) { Console.WriteLine(e.Message); Console.ReadLine(); }
}
12345678_0001
相关分类