Ejemplo n.º 1
0
        public void PutItem2()
        {
            var cliente = new DynamoDBClient();

            for (int i = 0; i < 1000; i++)
            {
                var attributes = new Dictionary <string, Amazon.DynamoDBv2.Model.AttributeValue>();
                attributes.Add("ID Tabla", new AttributeValue()
                {
                    S = Guid.NewGuid().ToString()
                });
                attributes.Add("Nombre", new AttributeValue()
                {
                    S = "Pedro" + i
                });
                attributes.Add("Apellido", new AttributeValue()
                {
                    S = "Perez" + i
                });
                attributes.Add("FechaNacimiento", new AttributeValue()
                {
                    S = DateTime.Now.ToString()
                });
                attributes.Add("Sueldo", new AttributeValue()
                {
                    N = (10023444.230 / (i + 1)).ToString(CultureInfo.InvariantCulture)
                });
                var p = cliente.PutItem("TestTable", attributes);
            }
        }
Ejemplo n.º 2
0
        public void PutItem3()
        {
            var cliente = new DynamoDBClient();

            Parallel.For(0, 1000, new ParallelOptions()
            {
                MaxDegreeOfParallelism = 4
            }, (i) =>
            {
                var attributes = new Dictionary <string, Amazon.DynamoDBv2.Model.AttributeValue>();
                attributes.Add("ID Tabla", new AttributeValue()
                {
                    S = Guid.NewGuid().ToString()
                });
                attributes.Add("Nombre", new AttributeValue()
                {
                    S = "Pedro" + i
                });
                attributes.Add("Apellido", new AttributeValue()
                {
                    S = "Perez" + i
                });
                attributes.Add("FechaNacimiento", new AttributeValue()
                {
                    S = DateTime.Now.ToString()
                });
                attributes.Add("Sueldo", new AttributeValue()
                {
                    N = (10023444.230 / (i + 1)).ToString(CultureInfo.InvariantCulture)
                });
                var p = cliente.PutItem("TestTable", attributes);
            });
        }
Ejemplo n.º 3
0
        public void PutItem()
        {
            var cliente    = new DynamoDBClient();
            var attributes = new Dictionary <string, Amazon.DynamoDBv2.Model.AttributeValue>();

            attributes.Add("ID Tabla", new AttributeValue()
            {
                S = Guid.NewGuid().ToString()
            });
            attributes.Add("Nombre", new AttributeValue()
            {
                S = "Pedro"
            });
            attributes.Add("Apellido", new AttributeValue()
            {
                S = "Perez"
            });
            attributes.Add("FechaNacimiento", new AttributeValue()
            {
                S = DateTime.Now.ToLongDateString()
            });
            attributes.Add("Sueldo", new AttributeValue()
            {
                N = "10023444.230"
            });

            var p = cliente.PutItem("TestTable", attributes);
        }