コード例 #1
0
 public DynamoDbTodoExample()
 {
     awsDb = CreateDynamoDbClient();
     db = new PocoDynamo(awsDb);
     db.RegisterTable<Todo>();
     db.InitSchema();
 }
コード例 #2
0
        public static List<Poco> PutPocoItems(IPocoDynamo db, int count = 10)
        {
            db.RegisterTable<Poco>();
            db.InitSchema();

            var items = count.Times(i => new Poco { Id = i + 1, Title = "Name " + i + 1 });

            db.PutItems(items);
            return items;
        }
コード例 #3
0
        protected DynamoMetadataType AssertTable(IPocoDynamo db, Type type, string hashField, string rangeField = null)
        {
            var table = db.GetTableMetadata(type);

            Assert.That(table.HashKey.Name, Is.EquivalentTo(hashField));

            if (rangeField == null)
                Assert.That(table.RangeKey, Is.Null);
            else
                Assert.That(table.RangeKey.Name, Is.EquivalentTo(rangeField));

            return table;
        }
コード例 #4
0
        private static Collection PutCollection(IPocoDynamo db)
        {
            db.RegisterTable<Collection>();
            db.InitSchema();

            var row = new Collection
            {
                Id = 1,
                Title = "Title 1"
            }
            .InitStrings(10.Times(i => ((char)('A' + i)).ToString()).ToArray())
            .InitInts(10.Times(i => i).ToArray());

            db.PutItem(row);
            return row;
        }
コード例 #5
0
 IUserAuthRepository CreateAuthRepo(IPocoDynamo db)
 {
     var authRepo = new DynamoDbAuthRepository(db);
     authRepo.InitSchema();
     return authRepo;
 }
コード例 #6
0
        private static Customer CreateCustomer(IPocoDynamo db)
        {
            var types = new List<Type>()
                .Add<Customer>()
                .Add<Order>();

            db.RegisterTables(types);

            db.InitSchema();

            var customer = new Customer
            {
                Name = "Customer #1",
                PrimaryAddress = new CustomerAddress
                {
                    AddressLine1 = "Line 1",
                    City = "Darwin",
                    State = "NT",
                    Country = "AU",
                }
            };

            db.PutItem(customer);
            return customer;
        }
コード例 #7
0
 private IUserAuthRepository CreateAuthRepo(IPocoDynamo db)
 {
     var authRepo = new DynamoDbAuthRepository<CustomUserAuth, CustomUserAuthDetails>(db);
     authRepo.InitSchema();
     return authRepo;
 }
コード例 #8
0
 public BaseService(IAmazonDynamoDB dynamoClient, IPocoDynamo pocoDynamo)
 {
     this.dynamoClient = dynamoClient;
     this.pocoDynamo   = pocoDynamo;
 }
コード例 #9
0
 public DynamoInitializer(IPocoDynamo pocoDynamo) => _pocoDynamo = pocoDynamo;