I am working in DyanmoDB.In My project i have to dynamically set the database name and i have to load the database dynamically. This is my code
using UnityEngine;
using System.Collections;
using Amazon.DynamoDBv2.DataModel;
using System.Collections.Generic;
using Amazon.DynamoDBv2;
using UnityEngine.UI;
using UnityEngine;
using System.Collections;
using Amazon.DynamoDBv2;
using UnityEngine.UI;
using Amazon;
namespace AWSSDK.Examples
{
public class HighLevel3 : DynamoDbBaseExample
{
private IAmazonDynamoDB _client;
private DynamoDBContext _context;
public Text resultText;
public Button back;
public Button createOperation;
public Button updateOperation;
public Button deleteOperation;
public string S_tablefieldset;
string bookID;
int bookID1 = 9;
public string Email;
private DynamoDBContext Context
{
get
{
if (_context == null)
_context = new DynamoDBContext(_client);
return _context;
}
}
void Awake()
{
back.onClick.AddListener(BackListener);
createOperation.onClick.AddListener(PerformCreateOperation);
_client = Client;
S_tablefieldset = "Orders";
HighLevelTableExample.GetDynamoDbOperationConfig(S_tablefieldset);
}
void Start()
{
bookID = SystemInfo.deviceUniqueIdentifier;
System.Environment.SetEnvironmentVariable("MONO_REFLECTION_SERIALIZER", "Orders");
PerformCreateOperation();
}
public static DynamoDBOperationConfig GetDynamoDbOperationConfig(string dynamoDbTable)
{
Debug.Log("The Table name is " + dynamoDbTable);
var tableName = System.Environment.GetEnvironmentVariable("MONO_REFLECTION_SERIALIZER");
Debug.Log("The Table name is" + tableName);
DynamoDBOperationConfig config = new DynamoDBOperationConfig()
{
// OverrideTableName =
OverrideTableName = tableName
};
return config;
}
public void PerformCreateOperation()
{
Debug.Log(" I am in Perform Create Operation is working fine and good");
Book12 myBook = new Book12
{
OrderID = bookID,
OrderItem = 50,
};
// Save the book.
var tableName = System.Environment.GetEnvironmentVariable("TABLE_NAME");
Context.SaveAsync(myBook, new DynamoDBOperationConfig {
OverrideTableName = tableName });
}
}
public class Book12 {
[DynamoDBHashKey] // Hash key.
public string OrderID { get; set; }
[DynamoDBProperty]
public string UserName { get; set; }
[DynamoDBProperty]
}
}
While doing the above i received the error in
error CS1503: Argument 2: cannot convert from
'Amazon.DynamoDBv2.DataModel.DynamoDBOperationConfig' to Amazon.DynamoDBv2.AmazonDynamoDBCallback'
How to solve the error.