locked
Odata Open Properties RRS feed

  • Question

  • Hi,

    I've been reading Alex's series on custom data providers and in particular untyped or dynamic properties. And I have some questions about dynamic properties:

    1.. Why wouldn't you use Open Properties for an untyped model? Alex avoided open properties maybe just because he was replicating the strongly typed example earlier but I'm wondering why not use the simpler Open Properties approach?

    2.. Vitek states in this thread for Q6 http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/thread/8bedacfb-95d4-4899-a3c3-38cdea981d1c that there isn't first class support in the client for open properties. Is there the intention to have 1st class support in the client for these in future?

    3.. If you have a datasource with considerable dynamic data and intend to write a custom data provider, which approach should I look at first for the most flexible clients? Clients will include MSOffice, Excel pivot and later WP7/iOS. I'd really like to make writing the clients as simple as possible ;-)

    4.. Is there any examples of how to handle open properties/ dynamic data from the client perspective anybody can point me to?

    Any thoughts appreciated. Thanks.

     

    Thursday, December 16, 2010 3:09 AM

Answers

  • Hi,

    1) Open properties are for services which have dynamic per-instance properties. The sample untyped provider could do open properties, it just chose not to, since it's usually not that common. Most services have the same set of properties on every entity instance and thus it's better to declare these in metadata. The Open properties approach is not necessarily simpler, first of all the LINQ provider for open properties get much more complicated (you have to rewrite even simple operators like add and sub, not just property accesses), second of all, you're making it harder for most clients to consume the service.

    2) It's on our list of candidates, if you want to give it a boost please vote for it as described here: http://blogs.msdn.com/b/astoriateam/archive/2010/09/10/what-do-you-want-to-see-added-changed-in-wcf-data-services.aspx

    3) The real question is what does "dynamic" mean here. Dynamic as in "each instance might have different set of properties" (in which case you need open properties), or dynamic as in "in a given point in time each instance has the same properties, but this changes over time" (in which case this is totally doable by modifying your service's metadata, you don't need open properties for this). If you need to use the open properties, then currently the client support is somewhat limited - I don't know what particular client supports these or not, I know that .NET clients don't out of the box.

    4) I'm not aware of a sample, but in general it requires parsing the XML by hand, which is not that hard, but it's more code obviously.

    Thanks,


    Vitek Karas [MSFT]
    • Marked as answer by ZRGN Monday, December 20, 2010 8:08 AM
    Thursday, December 16, 2010 2:26 PM
    Moderator