Reputation: 14871
Is there any way I can "reverse" the effect of an Odata service? i.e. the Odata web service generates an RSS xml string from an entity object.
is there a way I can do the reverse? i.e. generate an Entity object from an Odata string?
Basically, I am looking for Odata serialisers and deserialiser functions which I can use in, say, a console application, without having to create an Odata service.
I have access to the EDMX file using which the given OData string was generated. I just need the function to deserialise the data.
Upvotes: 1
Views: 1968
Reputation: 13310
This is almost exactly what ODataLib is for. It's a library which implements readers and writers for the OData format. It doesn't read or write actual entity objects, instead it represents entities as its own OM (so that you don't have to CLR types for each entity type). But turning the OM into actual instances is very easy.
ODataLib (Microsoft.Data.OData.dll) is available on NuGet, or it's part of the WCF Data Services 5.0 release.
Here's a very short sample of how it can be used: http://blogs.msdn.com/b/astoriateam/archive/2011/10/14/introducing-the-odata-library.aspx
Upvotes: 1
Reputation: 364259
These functions are internal implementation of WCF Data Services - all related internal classes should be inside System.Data.Services.Serializers
namespace.
You can try to use classes from System.ServiceModel.Syndication
to work with Atom / RSS feeds. I think data services use them internally but you will most probably reimplement part of OData processing already available in data services.
Upvotes: 0