コード例 #1
0
        /// <summary>
        /// Constructor used for testing passing in a preconfigured DynamoDB client.
        /// </summary>
        /// <param name="ddbClient"></param>
        /// <param name="tableName"></param>
        public Functions(IAmazonDynamoDB ddbClient, string tableName)
        {
            _dbContext = new DynamoDbContext(ddbClient);

            // if (!string.IsNullOrEmpty(tableName))
            // {
            //     AWSConfigsDynamoDB.Context.TypeMappings[typeof(SesEvent)] = new Amazon.Util.TypeMapping(typeof(SesEvent), tableName);
            // }

            // var config = new DynamoDBContextConfig { Conversion = DynamoDBEntryConversion.V2 };
            // this.DDBContext = new DynamoDBContext(ddbClient, config);
        }
コード例 #2
0
        /// <summary>
        /// Default constructor that Lambda will invoke.
        /// </summary>
        public Functions()
        {
            // Check to see if a table name was passed in through environment variables and if so
            // add the table mapping.
            // var tableName = System.Environment.GetEnvironmentVariable(TABLENAME_ENVIRONMENT_VARIABLE_LOOKUP);

            // if(!string.IsNullOrEmpty(tableName))
            // {
            //     AWSConfigsDynamoDB.Context.TypeMappings[typeof(SesEvent)] = new Amazon.Util.TypeMapping(typeof(SesEvent), tableName);
            // }

            // var config = new DynamoDBContextConfig { Conversion = DynamoDBEntryConversion.V2 };
            // this.DDBContext = new DynamoDBContext(new AmazonDynamoDBClient(), config);

            _dbContext = new DynamoDbContext(new AmazonDynamoDBClient());
        }
コード例 #3
0
 /// <summary>
 /// Default constructor. This constructor is used by Lambda to construct the instance. When invoked in a Lambda environment
 /// the AWS credentials will come from the IAM role associated with the function and the AWS region will be set to the
 /// region the Lambda function is executed in.
 /// </summary>
 public Function()
 {
     _dbContext = new DynamoDbContext(new AmazonDynamoDBClient());
 }