开发者

Exposing Azure Table with oData but working with "Domain" objects not Azure Entity Objects

Pardon my terminology i开发者_运维问答f incorrect but I'd rather not expose the Azure Table Entity objects directly to the end user, although I want to expose IQueryable.

How can I convert an IQueryable<TableEntity> to IQueryable<Object>

I'm basing my oData logic as explained in this blog. Do share a better way if you have one.

http://blogs.southworks.net/fboerr/2010/07/29/create-a-wcf-data-service-odata-to-share-an-azure-table/


WCF Data Services can expose arbitrary objects using a Reflection Provider. Instead of creating your classes by inheriting from TableServiceEntity you can create plain old C# classes with just the properties you like. In the query methods add a .Select() statement to create the POCO classes instead of the service classes.

You can also check How to: Create a Data Service Using the Reflection Provider (WCF Data Services) for a step by step guide.

On the other hand, your TableServiceEntity doesn't have to match the underlying columns exactly. You can create entities with fewer columns and return these with a Select statement

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜