Loading Metadata

For a full reference of OData metadata see: http://msdn.microsoft.com/en-us/library/ff478141.aspx Section 'Properties and Metadata'.

The key point is:

The document returned from the OData $metadata operation is defined by the “Entity Data Model for Data Services Packaging Format” specification[xii] (we’re just great at naming things here at Microsoft, aren’t we?), which is really just a small document that says it’s the Schema element under the Edmx and DataServices elements that you really care about. That Schema element and everything inside it is the “Conceptual Schema Definition File Format” specification, but we’ll just call it the “CSDL spec” (or Conceptual Schema Definition Language specification). CSDL defines Microsoft’s Entity Data Model (EDM), which is also the data model of OData. The CSDL specification tells us how we can interpret the result of the $metadata operation to see what kind of data is being exposed by the OData service.

What does this mean? Well when we load the contents of the Schema element, we should be able to create an EdmItemCollection (http://msdn.microsoft.com/en-us/library/system.data.metadata.edm.edmitemcollection.aspx) and load it directly from the XML in the Schema definition.


Therefore to load metadata, one loads the $metadata part of the service, extracts the contents of the Schema element and loads it via EdmItemCollection.

Last edited Nov 9, 2011 at 1:14 PM by dwmkerr, version 1


No comments yet.