当前位置: 首页>>代码示例>>C#>>正文


C# IAmazonDynamoDB类代码示例

本文整理汇总了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;
        }
开发者ID:vanderkorn,项目名称:linq2dynamodb,代码行数:7,代码来源:TestConfiguration.cs

示例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);
 }
开发者ID:aws,项目名称:aws-sdk-net,代码行数:8,代码来源:Table.Async.cs

示例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);
     });
 }
开发者ID:rajdotnet,项目名称:aws-sdk-net,代码行数:8,代码来源:TableUtils.cs

示例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));
        }
开发者ID:kingkino,项目名称:azure-documentdb-datamigrationtool,代码行数:11,代码来源:DynamoDbSourceAdapter.cs

示例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;
        }
开发者ID:rajdotnet,项目名称:aws-sdk-net,代码行数:14,代码来源:TableUtils.cs

示例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);
            }
        }
开发者ID:rajdotnet,项目名称:aws-sdk-net,代码行数:23,代码来源:TableUtils.cs

示例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;
            }
        }
开发者ID:rajdotnet,项目名称:aws-sdk-net,代码行数:37,代码来源:TableUtils.cs

示例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();
        }
开发者ID:johnryork,项目名称:aws-sdk-unity,代码行数:15,代码来源:Table.cs

示例9: DeleteTable

 private async Task DeleteTable(IAmazonDynamoDB dynamoDBClient, string tableName)
 {
     await dynamoDBClient.DeleteTableAsync(tableName);
 }
开发者ID:aws,项目名称:aws-sdk-net,代码行数:4,代码来源:DynamoDBTruncateError.cs

示例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;
        }
开发者ID:aws,项目名称:aws-sdk-net,代码行数:25,代码来源:DynamoDBTruncateError.cs

示例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);
 }
开发者ID:johnryork,项目名称:aws-sdk-unity,代码行数:15,代码来源:Table.cs

示例12: Start

	void Start() {
		if (PlayerPrefs.HasKey("checkForContent") && PlayerPrefs.GetInt("checkForContent") == 0) {
			finishedDownload = true;
		}
		_client = Client;
		S3BucketName = "captain-cillian-bucket";
	}
开发者ID:DiarmuidByrne,项目名称:Captain-Cillian,代码行数:7,代码来源:AWSManagerScript.cs

示例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();
        }
开发者ID:jamisliao,项目名称:aws-sdk-net-samples,代码行数:26,代码来源:Program.cs

示例14: SetUp

        public override void SetUp()
        {
            TablePrefix = typeof(TableManagementTests).Name + Guid.NewGuid();

            DynamoDbClient = TestConfiguration.GetDynamoDbClient();
            Context = TestConfiguration.GetDataContext(DynamoDbClient, TablePrefix);
        }
开发者ID:LCHarold,项目名称:linq2dynamodb,代码行数:7,代码来源:TableManagementTests.cs

示例15: DynamoDbTodoExample

 public DynamoDbTodoExample()
 {
     awsDb = CreateDynamoDbClient();
     db = new PocoDynamo(awsDb);
     db.RegisterTable<Todo>();
     db.InitSchema();
 }
开发者ID:derFunk,项目名称:ServiceStack.Aws,代码行数:7,代码来源:DynamoDbTodoExample.cs


注:本文中的IAmazonDynamoDB类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。