Reputation: 6262
New user to dynamodb and trying to integrate this with my .net core.
I have used the example at: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LowLevelDotNetItemsExample.html
Below is the sample example:
private static string tableName = "ProductCatalog";
private static AmazonDynamoDBClient client = new AmazonDynamoDBClient();
private static void CreateItem()
{
var request = new PutItemRequest
{
TableName = tableName,
Item = new Dictionary<string, AttributeValue>()
{
{ "Id", new AttributeValue {
N = "1000"
}},
{ "Title", new AttributeValue {
S = "Book 201 Title"
}},
{ "ISBN", new AttributeValue {
S = "11-11-11-11"
}},
{ "Authors", new AttributeValue {
SS = new List<string>{"Author1", "Author2" }
}},
{ "Price", new AttributeValue {
N = "20.00"
}},
{ "Dimensions", new AttributeValue {
S = "8.5x11.0x.75"
}},
{ "InPublication", new AttributeValue {
BOOL = false
} }
}
};
client.PutItem(request);
}
But when I run the code I get the errors:
Error CS0122 'AmazonDynamoDBClient.PutItem(PutItemRequest)' is inaccessible due to its protection level
Error CS0122 'AmazonDynamoDBClient.GetItem(GetItemRequest)' is inaccessible due to its protection level
and so on for all the request.
What is missing here?
Thanks
Upvotes: 2
Views: 2516
Reputation: 6262
Looks like we have to use async method for .net core in interacting with dynamo db.
More information can be found at : https://docs.aws.amazon.com/mobile/sdkforxamarin/developerguide/dynamodb-integration-docmodel.html
Though the link is for mobile platform but that is what I found out and works.
Upvotes: 1