【发布时间】:2012-10-09 23:35:29
【问题描述】:
我有一个名为“评论”的类型,我将其保存到 Azure 表存储。由于评论可以是任意数量的其他类型,因此我创建了一个所有这些类型都实现的接口,然后将 ICommentable 类型的属性放在评论上。所以 Comment 有一个名为 About 的 ICommentable 类型的属性。
当我尝试将评论保存到 Azure 表存储时,如果 Comment.About 属性具有值,我会收到无价值的无效输入错误。但是,如果 Comment.About 没有值,我没有问题。为什么会这样?
Comment.About 不是唯一作为引用类型的属性。例如,Comment.From 是引用类型,但 Comment.About 是接口类型的唯一属性。
失败:
var comment = new Comment();
comment.CommentText = "It fails!";
comment.PartitionKey = "TEST";
comment.RowKey = "TEST123";
comment.About = sow1;
comment.From = person1;
作品:
var comment = new Comment();
comment.CommentText = "It works!";
comment.PartitionKey = "TEST";
comment.RowKey = "TEST123";
//comment.About = sow1;
comment.From = person1;
谢谢!
【问题讨论】:
标签: azure azure-storage azure-table-storage