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


C# DynamoDBv2.AmazonDynamoDBConfig类代码示例

本文整理汇总了C#中Amazon.DynamoDBv2.AmazonDynamoDBConfig的典型用法代码示例。如果您正苦于以下问题:C# AmazonDynamoDBConfig类的具体用法?C# AmazonDynamoDBConfig怎么用?C# AmazonDynamoDBConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AmazonDynamoDBConfig类属于Amazon.DynamoDBv2命名空间,在下文中一共展示了AmazonDynamoDBConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConnectAmazonDynamoDB

 public AmazonDynamoDBClient ConnectAmazonDynamoDB(string ConnectionString)
 {
     var config = new AmazonDynamoDBConfig();
     config.ServiceURL = ConnectionString;
     var client = new AmazonDynamoDBClient(config);
     return client;
 }
开发者ID:fonnylasmana,项目名称:Health,代码行数:7,代码来源:Connection.cs

示例2: DynamoDBSink

 public DynamoDBSink(IFormatProvider formatProvider, string tableName) :base(1000, TimeSpan.FromSeconds(15))
 {
   _formatProvider = formatProvider;
   _tableName = tableName;
   AmazonDynamoDbConfig = new AmazonDynamoDBConfig();
   OperationConfig = new DynamoDBOperationConfig {OverrideTableName = tableName};
 }
开发者ID:harryross,项目名称:serilog-sinks-dynamodb,代码行数:7,代码来源:DynamoDBSink.cs

示例3: Main

        static void Main(string[] args)
        {
            var awsKey = "my-aws-key";
            var awsSecret = "my-aws-secret";
            var config = new AmazonDynamoDBConfig { ServiceURL = "http://localhost:8000" };

            var client = new AmazonDynamoDBClient(awsKey, awsSecret, config);
            var ctx = new DynamoDBContext(client);

            var userId = "theburningmonk-1";

            // query examples
            QueryByHashKey(userId, client, ctx);
            QueryWithRangeKey(userId, client, ctx);
            QueryWithOrderAndLimit(userId, client, ctx);
            QueryWithNoConsistentRead(userId, client, ctx);
            ThrottlingWithQueryPageSize(userId, client, ctx);
            SelectSpecificAttributes(userId, client, ctx);
            QueryWithNoReturnedConsumedCapacity(userId, client);
            QueryWithLocalSecondaryIndexAllAttributes(userId, client, ctx);
            QueryWithLocalSecondaryIndexProjectedAttributes(userId, client, ctx);
            QueryWithGlobalSecondaryIndexProjectedAttributes(client, ctx);

            // scan examples
            BasicScan(client, ctx);
            ScanWithLimit(client, ctx);
            ThrottlingWithScanPageSize(client, ctx);
            ScanWithScanPageSizeAndSegments(client, ctx);
            ScanWithNoReturnedConsumedCapacity(client);
            SelectSpecificAttributes(client, ctx);

            Console.WriteLine("all done...");

            Console.ReadKey();
        }
开发者ID:GeertVL,项目名称:DynamoDb.SQL,代码行数:35,代码来源:Program.cs

示例4: Load

    protected override void Load(ContainerBuilder builder)
    {
        var config = new AmazonDynamoDBConfig();
        config.RegionEndpoint = Amazon.RegionEndpoint.APSoutheast2;
        var client = new AmazonDynamoDBClient(config);

        builder.Register(c => client).As<IAmazonDynamoDB>();

        builder.RegisterType<SessionsRepository>().As<ISessionsRepository>();
    }
开发者ID:tmicheletto,项目名称:track-time,代码行数:10,代码来源:DefaultModule.cs

示例5: NotesDataContext

        static NotesDataContext()
        {
            // creating a DynamoDb client in some region (AmazonDynamoDBClient is thread-safe and can be reused
            var dynamoDbConfig = new AmazonDynamoDBConfig { RegionEndpoint = RegionEndpoint.APSoutheast1 };

            DynamoDbClient = new AmazonDynamoDBClient(dynamoDbConfig);

            // creating a MemcacheD client (it's thread-safe and can be reused)
            CacheClient = new MemcachedClient();

            // creating tables
            CreateTablesIfTheyDoNotExist();
        }
开发者ID:LCHarold,项目名称:linq2dynamodb,代码行数:13,代码来源:NotesDataContext.cs

示例6: GetPinWithPinID

        public Dictionary<string, object> GetPinWithPinID(string owner, double pinDate)
        {
            Dictionary<string, object> retval = new Dictionary<string, object>();
            QueryResponse response;
            var config = new AmazonDynamoDBConfig();
            config.ServiceURL = System.Configuration.ConfigurationManager.AppSettings["ServiceURL"];
            client = new AmazonDynamoDBClient(config);
            try
            {
                QueryRequest request = new QueryRequest()
                {
                    TableName = "Pin",
                    KeyConditions = new Dictionary<string, Condition>()
                    {
                        {
                            "Owner",
                            new Condition()
                            {
                                ComparisonOperator = ComparisonOperator.EQ,
                                AttributeValueList = new List<AttributeValue> { new AttributeValue { S = owner } }
                            }
                        },
                        {
                            "PinDate",
                            new Condition()
                            {
                                ComparisonOperator = ComparisonOperator.EQ,
                                AttributeValueList = new List<AttributeValue> { new AttributeValue { N = pinDate.ToString() } }
                            }
                        }
                    }

                };
                response = client.Query(request);
                retval.Add("Title", response.Items[0]["Title"].S);
                retval.Add("Owner", response.Items[0]["Owner"].S);
                retval.Add("OwnerName", response.Items[0]["UserName"].S);
                retval.Add("OwnerHeadshot", response.Items[0]["HeadshotURL"].S);
                retval.Add("Latitude", response.Items[0]["Latitude"].S);
                retval.Add("Longitude", response.Items[0]["Longitude"].S);
                retval.Add("PinDate", Convert.ToDouble(response.Items[0]["PinDate"].N));
                retval.Add("Images", response.Items[0]["Images"].SS);
            }
            catch (AmazonDynamoDBException e) { Console.WriteLine(e.Message); }
            catch (AmazonServiceException e) { Console.WriteLine(e.Message); }
            catch (Exception e) { Console.WriteLine(e.Message); }

            return retval;
        }
开发者ID:EchoPan,项目名称:BreadcrumbAPI,代码行数:49,代码来源:DataHelper.cs

示例7: CheckUserIsExist

        public bool CheckUserIsExist(string userID)
        {
            var config = new AmazonDynamoDBConfig();
            GetItemResponse response;
            config.ServiceURL = System.Configuration.ConfigurationManager.AppSettings["ServiceURL"];
            client = new AmazonDynamoDBClient(config);
            bool retval = false;
            try
            {
                GetItemRequest request = new GetItemRequest
                {
                    TableName = "User",
                    Key = new Dictionary<string, AttributeValue>() { { "UserID", new AttributeValue { S = userID } } },
                    ReturnConsumedCapacity = "TOTAL"
                };
                response = client.GetItem(request);
                retval = response.Item.Count > 0;
            }
            catch (AmazonDynamoDBException e) { Console.WriteLine(e.Message); }
            catch (AmazonServiceException e) { Console.WriteLine(e.Message); }
            catch (Exception e) { Console.WriteLine(e.Message); }

            return retval;
        }
开发者ID:EchoPan,项目名称:BreadcrumbAPI,代码行数:24,代码来源:DataHelper.cs

示例8: AmazonDynamoDBClient

 /// <summary>
 /// Constructs AmazonDynamoDBClient with AWS Credentials and an
 /// AmazonDynamoDBClient Configuration object.
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="clientConfig">The AmazonDynamoDBClient Configuration Object</param>
 public AmazonDynamoDBClient(AWSCredentials credentials, AmazonDynamoDBConfig clientConfig)
     : base(credentials, clientConfig)
 {
 }
开发者ID:sadiqj,项目名称:aws-sdk-xamarin,代码行数:10,代码来源:_AmazonDynamoDBClient.cs

示例9: AmazonDynamoDBClient

 /// <summary>
 /// Constructs AmazonDynamoDBClient with AWS Credentials and an
 /// AmazonDynamoDBClient Configuration object.
 /// </summary>
 /// <param name="credentials">AWS Credentials</param>
 /// <param name="clientConfig">The AmazonDynamoDBClient Configuration Object</param>
 public AmazonDynamoDBClient(AWSCredentials credentials, AmazonDynamoDBConfig clientConfig)
     : base(credentials, clientConfig, false, AuthenticationTypes.User | AuthenticationTypes.Session)
 {
 }
开发者ID:pbutlerm,项目名称:dataservices-sdk-dotnet,代码行数:10,代码来源:AmazonDynamoDBClient.cs

示例10: AmazonDynamoDBClient

 /// <summary>
 /// Constructs AmazonDynamoDBClient with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 /// 
 /// Example App.config with credentials set. 
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSProfileName" value="AWS Default"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 ///
 /// </summary>
 /// <param name="config">The AmazonDynamoDBClient Configuration Object</param>
 public AmazonDynamoDBClient(AmazonDynamoDBConfig config)
     : base(FallbackCredentialsFactory.GetCredentials(), config) { }
开发者ID:JonathanHenson,项目名称:aws-sdk-net,代码行数:18,代码来源:AmazonDynamoDBClient.cs

示例11: GetPinWithUserID

        public List<Dictionary<string, object>> GetPinWithUserID(string userID, double since, int takeCnt)
        {
            List<Dictionary<string, object>> retval = new List<Dictionary<string, object>>();
            Dictionary<string, object> tmpObject = null;
            QueryResponse response = null;
            var config = new AmazonDynamoDBConfig();
            config.ServiceURL = System.Configuration.ConfigurationManager.AppSettings["ServiceURL"];
            client = new AmazonDynamoDBClient(config);
            try
            {
                QueryRequest query = new QueryRequest()
                {
                    TableName = "Pin",
                    KeyConditions = new Dictionary<string, Condition>()
                    {
                        {
                            "Owner",
                            new Condition()
                            {
                                ComparisonOperator = ComparisonOperator.EQ,
                                AttributeValueList = new List<AttributeValue> { new AttributeValue { S = userID } }
                            }
                        },
                        {
                            "PinDate",
                            new Condition()
                            {
                                ComparisonOperator = ComparisonOperator.LT,
                                AttributeValueList = new List<AttributeValue> { new AttributeValue { N = since.ToString() } }
                            }
                        }
                    },
                    Limit = takeCnt,
                    ScanIndexForward = false

                };

                response = client.Query(query);
                foreach (var item in response.Items)
                {
                    tmpObject = new Dictionary<string, object>();
                    tmpObject.Add("Title", item["Title"].S);
                    tmpObject.Add("Owner", item["Owner"].S);
                    tmpObject.Add("OwnerName", item["UserName"].S);
                    tmpObject.Add("OwnerHeadshot", item["HeadshotURL"].S);
                    tmpObject.Add("Latitude", item["Latitude"].S);
                    tmpObject.Add("Longitude", item["Longitude"].S);
                    tmpObject.Add("PinDate", Convert.ToDouble(item["PinDate"].N));
                    tmpObject.Add("Images", item["Images"].SS);
                    retval.Add(tmpObject);
                }
            }
            catch (AmazonDynamoDBException e) { Console.WriteLine(e.Message); }
            catch (AmazonServiceException e) { Console.WriteLine(e.Message); }
            catch (Exception e) { Console.WriteLine(e.Message); }

            return retval;
        }
开发者ID:EchoPan,项目名称:BreadcrumbAPI,代码行数:58,代码来源:DataHelper.cs

示例12: DynamoDBTruncateErrorTest

        public async Task DynamoDBTruncateErrorTest()
        {           
            var config = new AmazonDynamoDBConfig
            {
                RegionEndpoint = RegionEndpoint.USEast1,
                LogResponse = true
            };
            AmazonDynamoDBClient client = new AmazonDynamoDBClient(config);
            var tableName= await SetupTable(client);
            try
            {
                var table = Table.LoadTable(client, tableName);

                await InsertData(table, "445", _body);
                var body = await ReadData(table, "445");
                Assert.Equal(_body, body);
            }
            finally
            {
                await DeleteTable(client, tableName);
            }
        }
开发者ID:aws,项目名称:aws-sdk-net,代码行数:22,代码来源:DynamoDBTruncateError.cs

示例13: TestLargeRetryCount

        public void TestLargeRetryCount()
        {
            var maxRetries = 1000;
            var maxMilliseconds = 1;
            ClientConfig config = new AmazonDynamoDBConfig();
            config.MaxErrorRetry = 100;
            var coreRetryPolicy = new DefaultRetryPolicy(config)
            {
                MaxBackoffInMilliseconds = maxMilliseconds
            };
            var ddbRetryPolicy = new DynamoDBRetryPolicy(config)
            {
                MaxBackoffInMilliseconds = maxMilliseconds
            };

            var context = new ExecutionContext(new RequestContext(false), null);
            for (int i = 0; i < maxRetries; i++)
            {
                context.RequestContext.Retries = i;
                coreRetryPolicy.WaitBeforeRetry(context);
                ddbRetryPolicy.WaitBeforeRetry(context);
            }
        }
开发者ID:aws,项目名称:aws-sdk-net,代码行数:23,代码来源:General.cs

示例14: CreateAmazonDynamoDBClient

 /// <summary>
 /// Create a client for the Amazon DynamoDB Service with the credentials loaded from the application's
 /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
 /// 
 /// Example App.config with credentials set. 
 /// <code>
 /// &lt;?xml version="1.0" encoding="utf-8" ?&gt;
 /// &lt;configuration&gt;
 ///     &lt;appSettings&gt;
 ///         &lt;add key="AWSAccessKey" value="********************"/&gt;
 ///         &lt;add key="AWSSecretKey" value="****************************************"/&gt;
 ///     &lt;/appSettings&gt;
 /// &lt;/configuration&gt;
 /// </code>
 /// </summary>
 /// <param name="config">Configuration options for the service like HTTP Proxy, # of connections, etc</param>
 /// <returns>An Amazon DynamoDB client</returns>
 public static IAmazonDynamoDB CreateAmazonDynamoDBClient(AmazonDynamoDBConfig config)
 {
     return new AmazonDynamoDBClient(config);
 }
开发者ID:rinselmann,项目名称:aws-sdk-net,代码行数:21,代码来源:AWSClientFactory.cs

示例15: CreateAmazonDynamoDBClient

 /// <summary>
 /// Create a client for the Amazon DynamoDB Service with the specified configuration
 /// </summary>
 /// <param name="awsAccessKey">The AWS Access Key associated with the account</param>
 /// <param name="awsSecretAccessKey">The AWS Secret Access Key associated with the account</param>
 /// <param name="config">Configuration options for the service like HTTP Proxy, # of connections, etc
 /// </param>
 /// <returns>An Amazon DynamoDB client</returns>
 /// <remarks>
 /// </remarks>
 public static IAmazonDynamoDB CreateAmazonDynamoDBClient(
     string awsAccessKey,
     string awsSecretAccessKey, AmazonDynamoDBConfig config
     )
 {
     return new AmazonDynamoDBClient(awsAccessKey, awsSecretAccessKey, config);
 }
开发者ID:sadiqj,项目名称:aws-sdk-xamarin,代码行数:17,代码来源:AWSClientFactory.cs


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