public byte[] ProtoSerializeProduct(ProductProtobuf product) { using (var stream = new MemoryStream()) { Serializer.Serialize(stream, product); return(stream.ToArray()); } }
public void ProtobufSerializationBenchmark() { ProductProtobuf product = new ProductProtobuf() { Id = 1, Description = "The next generation of widgets are here, order one today!", Manufacturer = "ACME Corp", Name = "Widget 2.0", Price = 5.00f }; var serializedProdct = ProtoSerializeProduct(product); Bin bin = new Bin(Bin, serializedProdct); Key key = new Key(Namespace, Set, ProtobufBenchmarkKey); _client.Put(null, key, bin); }
public void CreateTestObjectsEnMasse() { for (int x = 0; x < TestObjectCount; x++) { ProductProtobuf product = new ProductProtobuf() { Id = x, Description = "The next generation of widgets are here, order one today!", Manufacturer = "ACME Corp", Name = "Widget 2.0", Price = 5.00f }; var serializedProdct = JsonConvert.SerializeObject(product); Bin bin = new Bin(Bin, serializedProdct); string testKey = $"{IncrementalKeyBase}-{x}"; Key key = new Key(Namespace, Set, testKey); _client.Put(null, key, bin); } }