将 Azure 表存储公开为 OData
我在 Azure 表存储中有一个表,其中填充了基本 TableServiceEntity 的不同实现。有人如何通过 OData 公开这一点吗?有一些可用的最佳实践吗?
I have an table in the Azure Table Storage populated with different implementations of the base TableServiceEntity. Does anybody howto expose this through OData? Are there some best practices available?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
还有另一种解决方案。可能更复杂,但我在我的一个项目中使用它。
我有一个包含多个不同 TableServiceEntities 的表。但是当我查询表时,我以 .take(100) 为例,我想要一次所有不同的类型。
此链接对我帮助很大:
http://www.wintellect.com/Articles/Working%20with%20Azure%20Tables%20with%20Multiple%20Entity%20Schemas%20by%20Jeffrey%20Richter.pdf
There is another solutation as well. Might be more complex but I use it it in one off my projects.
I have a table that has multiple different TableServiceEntities. But when I query the table, I .take(100) for example, I want all the different types at once.
This link has helped me quite a bit:
http://www.wintellect.com/Articles/Working%20with%20Azure%20Tables%20with%20Multiple%20Entity%20Schemas%20by%20Jeffrey%20Richter.pdf
答案可以在这篇文章中找到: 如何在不知道架构的情况下访问表存储实体
。重写
TableServiceContext
上的ReadingEntity
事件将使您有机会将未知数据类型映射到可用类型。文章也显示了确切的代码。the answer can be found in this article: How to access table storage entities without knowing the schema
. Overriding the
ReadingEntity
event on theTableServiceContext
will give you the opportunity to map the unknown datatypes to the available types. The article shows the exact code too.