/// <summary>Converts a <c>CloudEntity</c> toward a <c>FatEntity</c>.</summary> public static FatEntity Convert <T>(CloudEntity <T> cloudEntity, IDataSerializer serializer) { var fatEntity = new FatEntity { PartitionKey = cloudEntity.PartitionKey, RowKey = cloudEntity.RowKey, Timestamp = cloudEntity.Timestamp }; using (var stream = new MemoryStream()) { serializer.Serialize(cloudEntity.Value, stream, typeof(T)); fatEntity.SetData(stream.ToArray()); return(fatEntity); } }
/// <summary>Converts a <c>FatEntity</c> toward a <c>CloudEntity</c>.</summary> public static CloudEntity <T> Convert <T>(FatEntity fatEntity, IDataSerializer serializer) { using (var stream = new MemoryStream(fatEntity.GetData()) { Position = 0 }) { var val = (T)serializer.Deserialize(stream, typeof(T)); return(new CloudEntity <T> { PartitionKey = fatEntity.PartitionKey, RowKey = fatEntity.RowKey, Timestamp = fatEntity.Timestamp, //ETag = etag, Value = val }); } }