我建议查看Lokad.Cloud for Azure框架(开源)。有一个经过生产测试的代码,用于将大型实体序列化到表存储中,限制为 960KB(属性拆分和管理由框架处理)
这是FatEntities wiki的示例用法
// TODO: change your connection string here
var providers = Standalone.CreateProviders(
"DefaultEndpointsProtocol=https;AccountName=;AccountKey=");
// 'books' is the name of the table
var books = new CloudTable<Book>(providers.TableStorage, "books");
var potterBook = new Book
{ Author = "J. K. Rowling", Title = "Harry Potter" };
var poemsBook = new Book
{ Author = "John Keats", Title = "Complete Poems" };
// inserting (or updating record in Table Storage)
books.Upsert(new[]
{
new CloudEntity<Book> {
PartitionKey = "UK", RowRey = "potter", Value = potterBook},
new CloudEntity<Book> {
PartitionKey = "UK", RowRey = "poems", Value = poemsBook}
});
// reading from table
foreach(var entity in books.Get())
{
Console.WriteLine("{0} by {1} in partition '{2}' and rowkey '{3}'",
entity.Value.Title, entity.Value.Author,
entity.PartitionKey, entity.RowRey);
}
Console.WriteLine("Press enter to exit.");
Console.ReadLine();