ODataLib for OData v4 2

Great news! The first release of ODataLib for OData v4 has just gone out the door. You can pick it up through NuGet by installing the Microsoft.OData.Core package. You can see the package page for full release details, but I’ll give a little color commentary below. (This is not the official word of the team ...

OData Error Handling 5

Ather Murtuzapurwala recently asked this question in the comments section of another post: How to propagate exception to client side, what is the best practice generally ? Is it good practice to handle exception at server side and send custom error object with Response status is 200 ok ? This is a great question, and ...

Writing a Service Document with ODataLib 4

The Atom Publishing Protocol introduced the concept of a “service document,” which lists the available collections of a service. In OData, we reused this concept and kept the same payload format. OData clients can discover which entity sets are available through the service document, and the document’s URL is usually used as the navigation root ...

New in ODataLib 5.6: Writing JSON Responses Gets a Whole Lot Easier 14

I’m really excited to tell you about a feature we’ve added in ODataLib 5.6 that will simplify the code of anyone using ODataLib to write an OData server that supports the new JSON format. The Motivation If you recall, the new OData JSON format has three levels of in-payload metadata verbosity. The Content-Type HTTP header ...

ODataLib Overview Slides 3

I recently gave a quick presentation on the goals and basic usage of ODataLib. The slides don’t go into much detail, but they may be useful if you’re trying to get a broad overview of the library. You can find my slides here.

Writing Multiple Entities with ODataLib 7

I’ve written some quickstart guides on how to write single entry payloads with ODataLib (see this post for the basics and then this post for how to write in the new JSON format), but most payloads have multiple entities in them. In this blog post, I’ll show you how to write a top-level feed payload ...

Writing a JSON payload with ODataLib 2

In a previous post, I demonstrated the simplest way write a single entity payload with ODataLib, the low-level OData serialization library. That example included just the bare essentials required for writing, but you’ll need more than that for most real-world scenarios. For example, writing a payload in the new JSON format requires some extra setup, ...

Working with Atom metadata 6

ODataLib can make producing or consuming OData Atom payloads much easier than it would be if you were working with the XML directly. But by not having total control over the XML, you might find yourself in a position where you need to write or read parts of the Atom payload that are defined by ...

Fix for error message: No TypeName was found for ODataComplexValue…

I’ve seen several users of ODataLib run into this error message, so I thought I ought to provide a place where others can hopefully land via a search engine query. If you get an ODataException thrown with this message: No TypeName was found for an ODataComplexValue of an open property, ODataEntry or custom instance annotation, ...

Creating an IEdmModel from a $metadata document 4

Let’s say you’re a client and you want to turn the CSDL at an OData server’s $metadata endpoint into an instance of IEdmModel that you can ask questions about or pass along to ODataLib (which requires a model for JSON reading and writing). This is all it takes: C# HttpWebRequest request = HttpWebRequest.CreateHttp("http://services.odata.org/v3/odata/OData.svc/$metadata"); ClientHttpResponseMessage metadataMessage ...