• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# DynamoDBv2.AmazonDynamoDBConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Main

        public static void Main(string[] args)
        {
            try
            {
                var config = new AmazonDynamoDBConfig();
                config.ServiceURL = System.Configuration.ConfigurationManager.AppSettings["ServiceURL"];
                client = new AmazonDynamoDBClient(config);
             //       InsertData();
              //   GetData("5", "Test");
            //                DeleteData("5", "Test");
               // InsertData1();
                //DeleteData1(5);
                //GetData1(4);
                Update1(11);
            }
            catch (Exception ex)
            {

            }
        }
开发者ID:ChunTaiChen,项目名称:AwsConsoleApp1,代码行数:20,代码来源:Program.cs


示例17: InsertUser

        public bool InsertUser(Dictionary<string, object> us)
        {
            var config = new AmazonDynamoDBConfig();
            config.ServiceURL = System.Configuration.ConfigurationManager.AppSettings["ServiceURL"];
            client = new AmazonDynamoDBClient(config);

            try
            {
                PutItemRequest putReq = new PutItemRequest
                {
                    TableName = "User",
                    Item = new Dictionary<string, AttributeValue>() {
                        { "UserID", new AttributeValue { S = us["userID"].ToString() } } ,
                        { "UserName", new AttributeValue { S = us["userName"].ToString() } } ,
                        { "HeadshotURL", new AttributeValue { S = us["headshotURL"].ToString() } } ,
                        { "IsPayUser", new AttributeValue { S = us["IsPayUser"].ToString() } } ,
                        { "RegistDate", new AttributeValue { N = us["registDate"].ToString() } } ,
                        { "LastLoginDate", new AttributeValue { N = us["lastLoginDate"].ToString() } } ,
                        { "LastSyncDate", new AttributeValue { N = us["lastSyncDate"].ToString() } }
                    }
                };

                PutItemResponse response = client.PutItem(putReq);
            }
            catch (AmazonDynamoDBException e) { Console.WriteLine(e.Message); }
            catch (AmazonServiceException e) { Console.WriteLine(e.Message); }
            catch (Exception e) { Console.WriteLine(e.Message); }

            //using (PinContext context = new PinContext(PinConnString))
            //{

            //    context.Entry(us).State = EntityState.Added;

            //    context.SaveChanges();
            //}
            return true;
        }
开发者ID:EchoPan,项目名称:BreadcrumbAPI,代码行数:37,代码来源:DataHelper.cs


示例18: GetUser

        public Dictionary<string, object> GetUser(string userID)
        {
            Dictionary<string, object> retval = new Dictionary<string, object>();
            GetItemResponse response;
            var config = new AmazonDynamoDBConfig();
            config.ServiceURL = System.Configuration.ConfigurationManager.AppSettings["ServiceURL"];
            client = new AmazonDynamoDBClient(config);
            try
            {
                GetItemRequest request = new GetItemRequest
                {
                    TableName = "User",
                    Key = new Dictionary<string, AttributeValue>() { { "UserID", new AttributeValue { S = userID } } },
                    ReturnConsumedCapacity = "TOTAL"
                };
                response = client.GetItem(request);
                retval.Add("UserID", response.Item["UserID"].S);
                retval.Add("HeadshotURL", response.Item["HeadshotURL"].S);
                retval.Add("IsPayUser", Convert.ToBoolean(response.Item["IsPayUser"].S));
                retval.Add("UserName", response.Item["UserName"].S);
                retval.Add("RegistDate", response.Item["RegistDate"].N);
                retval.Add("LastLoginDate", response.Item["LastLoginDate"].N);
                retval.Add("LastSyncDate", response.Item["LastSyncDate"].N);
            }
            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,代码行数:30,代码来源:DataHelper.cs


示例19: GetPinWithUserIDs

        public List<Dictionary<string, object>> GetPinWithUserIDs(List<string> userIDs, double since, int takeCnt)
        {
            List<Dictionary<string, object>> retval = new List<Dictionary<string, object>>();
            Dictionary<string, object> tmpObject = null;

            var config = new AmazonDynamoDBConfig();
            config.ServiceURL = System.Configuration.ConfigurationManager.AppSettings["ServiceURL"];
            client = new AmazonDynamoDBClient(config);
            List<AttributeValue> users = new List<AttributeValue>();
            foreach (string item in userIDs)
            {
                users.Add(new AttributeValue() { S = item });
            }
            try
            {
                ScanRequest sreq = new ScanRequest()
                {
                    TableName = "Pin",
                    ScanFilter = new Dictionary<string, Condition>()
                    {
                        {   "Owner",
                            new Condition
                            {
                                ComparisonOperator = ComparisonOperator.IN,
                                AttributeValueList = users
                            }
                        },
                        {
                            "PinDate",
                            new Condition()
                            {
                                ComparisonOperator = ComparisonOperator.LT,
                                AttributeValueList = new List<AttributeValue> { new AttributeValue { N = since.ToString() } }
                            }
                        }
                    }
                };

                var response = client.Scan(sreq);
                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);
                }
                retval = retval.OrderByDescending(a => a["PinDate"]).ToList<Dictionary<string, object>>();
            }
            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,代码行数:60,代码来源:DataHelper.cs


示例20: DynamoController

 public DynamoController()
 {
     var config = new AmazonDynamoDBConfig();
     config.ServiceURL = "https://dynamodb.eu-central-1.amazonaws.com/";
     _client = new AmazonDynamoDBClient(ConfigurationManager.AppSettings["AWSAccessKey"], ConfigurationManager.AppSettings["AWSSecretAccessKey"], config);
 }
开发者ID:Neonsonne,项目名称:dbSpeed,代码行数:6,代码来源:DynamoController.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DocumentModel.Table类代码示例发布时间:2022-05-24
下一篇:
C# DocumentModel.Primitive类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap