Exemplo n.º 1
0
        private FatEntity ConvertToFatEntity(E entity)
        {
            byte[] data;
            if (entity.DataObject == null)
            {
                data = new byte[0];
            }
            else
            {
                data = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(entity.DataObject));

                if (_encryptor != null)
                {
                    using (var ms = new MemoryStream())
                    {
                        using (var enc = _encryptor.Encrypt(ms, false))
                        {
                            enc.Write(data, 0, data.Length);
                        }

                        data = ms.ToArray();
                    }
                }
            }

            var fat = new FatEntity()
            {
                PartitionKey = entity.PartitionKey,
                RowKey       = entity.RowKey
            };

            fat.SetData(data, data.Length);
            return(fat);
        }
Exemplo n.º 2
0
        private FatEntity BuildEntity(string partitionKey, string rowKey)
        {
            var e = new FatEntity {
                PartitionKey = partitionKey, RowKey = rowKey, ETag = "*"
            };
            var data  = new { testdata = "blah" };
            var bytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(data));

            e.SetData(bytes, bytes.Length);
            return(e);
        }