【发布时间】:2013-08-24 16:39:11
【问题描述】:
如果我有一个用户定义的 CLR 对象,它们都继承自 TableEntity,例如这些 CLR:
public class Person : TableEntity
{
public string FirstName { get; set; }
public string Prefix { get; set; }
public string LastName { get; set; }
public string EmailAddress { get; set; }
public Address Address { get; set; }
public List<string> AList { get; set; }
public List<Urls> ListUrls { get; set; }
}
public class Address : TableEntity
{
public string Street { get; set; }
public string Zipcode { get; set; }
public string HouseNumber { get; set; }
public string City { get; set; }
}
public class Urls : TableEntity
{
public Uri Real { get; set; }
public Uri Fake { get; set; }
}
注意:我知道属性和类必须用Protobuf-net 的属性进行修饰。但为了简单起见,我暂时忽略了这些。
我想使用Protobuf-net 将其转换为byte[] 并将其序列化到Windows Azure 存储并将其反序列化回这些CLR 对象。我怎样才能做到这一点?
我遵循this 教程,但我被byte[] 卡住了。我不知道怎么写一个byte[]到表中。
如果问题不明确,请告诉我,我会尝试澄清更多。
【问题讨论】:
标签: c# serialization azure azure-storage protobuf-net