Exemplo n.º 1
0
        public async Task <ObjectTest> FunctionHandler(string input, ILambdaContext context)
        {
            var objectTest = new ObjectTest {
                Key    = input,
                Values = new ObjectValues {
                    MydateTime = DateTime.Now
                },
                EnableAws         = true,
                UseSecrets        = true,
                UseParameterStore = true
            };

            if (!await DynamoDbEntityRepository.TableExists("dynamic_object_storage").ConfigureAwait(false))
            {
                await DynamoDbEntityRepository.CreateTable("dynamic_object_storage",
                                                           new List <KeySchemaElement> {
                    new KeySchemaElement {
                        AttributeName = DynamoDbGeneralObjectStorageAttributes.AttributeKey, KeyType = KeyType.HASH
                    }
                },
                                                           new List <AttributeDefinition> {
                    new AttributeDefinition {
                        AttributeName = DynamoDbGeneralObjectStorageAttributes.AttributeKey, AttributeType = ScalarAttributeType.S
                    }
                }).ConfigureAwait(false);
            }

            await DynamoDbEntityRepository.Put("dynamic_object_storage", input, objectTest).ConfigureAwait(false);

            var criteria = new DynamoSearchCriteria();

            criteria.AddQueryCriteria(DynamoDbGeneralObjectStorageAttributes.AttributeKey, input, QueryOperator.Equal); // For query method
            var result = await DynamoDbEntityRepository.Get <ObjectTest>("dynamic_object_storage", criteria.GetCriteriaScanFilterForSearchCriteria()).ConfigureAwait(false);

            return(result.FirstOrDefault());
        }
Exemplo n.º 2
0
 public Task <IList <T> > Get <T>(DynamoSearchCriteria searchCriteria) where T : class
 {
     return(Get <T>(searchCriteria.GetScanConditionList()));
 }
Exemplo n.º 3
0
 public Task <IList <T> > Get(DynamoSearchCriteria searchCriteria)
 {
     return(Get(searchCriteria.GetScanConditionList()));
 }