本文整理汇总了C#中IAmazonDynamoDB类的典型用法代码示例。如果您正苦于以下问题:C# IAmazonDynamoDB类的具体用法?C# IAmazonDynamoDB怎么用?C# IAmazonDynamoDB使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IAmazonDynamoDB类属于命名空间,在下文中一共展示了IAmazonDynamoDB类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDataContext
public static DataContext GetDataContext(IAmazonDynamoDB dynamoDbClient, string tablePrefix)
{
var dataContext = new DataContext(dynamoDbClient, tablePrefix);
dataContext.OnLog += DataContextLogger.Debug;
return dataContext;
}
示例2: LoadTableAsync
internal static void LoadTableAsync(IAmazonDynamoDB ddbClient, string tableName, Table.DynamoDBConsumer consumer, DynamoDBEntryConversion conversion, AmazonDynamoDBCallback<Table> callback, AsyncOptions asyncOptions = null)
{
asyncOptions = asyncOptions??new AsyncOptions();
DynamoDBAsyncExecutor.ExecuteAsync<Table>(
()=>{
return LoadTable(ddbClient,tableName,consumer,conversion);
},asyncOptions,callback);
}
示例3: WaitUntilTableCreated
public static void WaitUntilTableCreated(string tableName, IAmazonDynamoDB client)
{
Common.WaitUntil(() =>
{
string status = GetTableStatus(tableName, client);
return !status.Equals("CREATING") && !status.Equals(string.Empty);
});
}
示例4: DynamoDbSourceAdapter
public DynamoDbSourceAdapter(IAmazonDynamoDB client, IDynamoDbSourceAdapterInstanceConfiguration configuration)
{
Guard.NotNull("client", client);
Guard.NotNull("configuration", configuration);
dataProvider = IsQueryRequest(configuration.Request)
? (IDataPageProvider)new QueryDataPageProvider(client,
RequestReader.Instance.Read<QueryRequest>(configuration.Request))
: new ScanDataPageProvider(client,
RequestReader.Instance.Read<ScanRequest>(configuration.Request));
}
示例5: WaitUntilTableStable
private static string WaitUntilTableStable(string tableName, IAmazonDynamoDB client, string tableStatus)
{
Common.WaitUntil(() =>
{
tableStatus = GetTableStatus(tableName, client);
if (tableStatus == null)
return true;
return
!tableStatus.Equals("DELETING", StringComparison.OrdinalIgnoreCase) &&
!tableStatus.Equals("CREATING", StringComparison.OrdinalIgnoreCase);
});
return tableStatus;
}
示例6: ConfirmTableExistence
public static void ConfirmTableExistence(string tableName, IAmazonDynamoDB client, List<KeySchemaElement> tableSchema, List<AttributeDefinition> attributeDefinitions, int reads, int writes)
{
Console.WriteLine("Confirming table " + tableName + " existence");
string tableStatus = null;
tableStatus = WaitUntilTableStable(tableName, client, tableStatus);
if (string.IsNullOrEmpty(tableStatus))
{
Console.WriteLine("Creating table " + tableName);
var tableDescription = client.CreateTable(new CreateTableRequest
{
TableName = tableName,
ProvisionedThroughput = new ProvisionedThroughput { ReadCapacityUnits = reads, WriteCapacityUnits = writes },
KeySchema = tableSchema,
AttributeDefinitions = attributeDefinitions
}).TableDescription;
WaitUntilTableCreated(tableName, client);
}
else
{
Console.WriteLine("Not creating table " + tableName + ", status is " + tableStatus);
}
}
示例7: DeleteTables
public static void DeleteTables(IAmazonDynamoDB client, Predicate<string> tableNameMatch)
{
try
{
var tableNames = client.ListTables().TableNames;
foreach (var tableName in tableNames)
{
DescribeTableResponse descResponse = client.DescribeTable(new DescribeTableRequest { TableName = tableName });
if (descResponse.Table == null)
continue;
TableDescription table = descResponse.Table;
if (table.TableStatus == TableStatus.ACTIVE && tableNameMatch(table.TableName))
{
Console.WriteLine("Table: {0}, {1}, {2}, {3}", table.TableName, table.TableStatus, table.ProvisionedThroughput.ReadCapacityUnits, table.ProvisionedThroughput.WriteCapacityUnits);
Console.WriteLine("Deleting table " + table.TableName + "...");
try
{
client.DeleteTable(new DeleteTableRequest { TableName = table.TableName });
WaitUntilTableDeleted(table.TableName, client);
Console.WriteLine("Succeeded!");
}
catch
{
Console.WriteLine("Failed!");
}
}
}
Console.WriteLine(tableNames.Count);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
throw;
}
}
示例8: Table
private Table(IAmazonDynamoDB ddbClient, string tableName, Table.DynamoDBConsumer consumer, DynamoDBEntryConversion conversion)
{
#if (WIN_RT || WINDOWS_PHONE || AWSSDK_UNITY)
DDBClient = ddbClient as AmazonDynamoDBClient;
#else
DDBClient = ddbClient;
#endif
TableInfoCache = SdkCache.GetCache<string, TableDescription>(ddbClient, TableInfoCacheIdentifier, StringComparer.Ordinal);
LoggerInstance = Logger.GetLogger(typeof(SdkCache));
TableConsumer = consumer;
TableName = tableName;
Conversion = conversion;
ClearTableData();
}
示例9: DeleteTable
private async Task DeleteTable(IAmazonDynamoDB dynamoDBClient, string tableName)
{
await dynamoDBClient.DeleteTableAsync(tableName);
}
示例10: SetupTable
private async Task<string> SetupTable(IAmazonDynamoDB dynamoDBClient)
{
string tableName = "aws-sdk-dotnet-truncate-test-" + DateTime.Now.Ticks;
await dynamoDBClient.CreateTableAsync(
tableName,
new List<KeySchemaElement>
{
new KeySchemaElement { KeyType = KeyType.HASH, AttributeName = "Id" }
},
new List<AttributeDefinition>
{
new AttributeDefinition { AttributeName = "Id", AttributeType = ScalarAttributeType.S }
},
new ProvisionedThroughput { ReadCapacityUnits = 10, WriteCapacityUnits = 10 });
DescribeTableResponse response = null;
do
{
System.Threading.Thread.Sleep(300);
response = await dynamoDBClient.DescribeTableAsync(tableName);
} while (response.Table.TableStatus != TableStatus.ACTIVE);
return tableName;
}
示例11: LoadTable
/// <summary>
/// Creates a Table object with the specified name, using the
/// passed-in client to load the table definition.
/// The returned table will use the conversion specified by
/// AWSConfigs.DynamoDBConfig.ConversionSchema
///
/// This method will throw an exception if the table does not exist.
/// </summary>
/// <param name="ddbClient">Client to use to access DynamoDB.</param>
/// <param name="tableName">Name of the table.</param>
/// <returns>Table object representing the specified table.</returns>
public static Table LoadTable(IAmazonDynamoDB ddbClient, string tableName)
{
return LoadTable(ddbClient, tableName, DynamoDBEntryConversion.CurrentConversion);
}
示例12: Start
void Start() {
if (PlayerPrefs.HasKey("checkForContent") && PlayerPrefs.GetInt("checkForContent") == 0) {
finishedDownload = true;
}
_client = Client;
S3BucketName = "captain-cillian-bucket";
}
示例13: Main
public static void Main(string[] args)
{
Console.WriteLine();
Console.WriteLine("Setting up DynamoDB client");
client = new AmazonDynamoDBClient(RegionEndpoint.USWest2);
Console.WriteLine();
Console.WriteLine("Creating sample tables");
CreateSampleTables();
Console.WriteLine();
Console.WriteLine("Running DataModel sample");
RunDataModelSample();
Console.WriteLine();
Console.WriteLine("Running DataModel sample");
RunDocumentModelSample();
Console.WriteLine();
Console.WriteLine("Removing sample tables");
DeleteSampleTables();
Console.WriteLine();
Console.WriteLine("Press Enter to continue...");
Console.Read();
}
示例14: SetUp
public override void SetUp()
{
TablePrefix = typeof(TableManagementTests).Name + Guid.NewGuid();
DynamoDbClient = TestConfiguration.GetDynamoDbClient();
Context = TestConfiguration.GetDataContext(DynamoDbClient, TablePrefix);
}
示例15: DynamoDbTodoExample
public DynamoDbTodoExample()
{
awsDb = CreateDynamoDbClient();
db = new PocoDynamo(awsDb);
db.RegisterTable<Todo>();
db.InitSchema();
}