This project is read-only.


Support insert and bind of entities via links


In ODataService sample, Product entity type has a required relationship with ProductFamily. Product cannot exist without a Product Family.

Currently we can submit a Product without any existing relationship with a ProductFamily. I believe we should throw some kind of validation error. According to insert and bind' we could supply the rel links to which you would want to associate the to-be-created entity instance. Since this scenario is fairly common, we should support it.

Following is an example from the OData PDF spec: Examples

Example 1: Insert a new Customer and bind it to existing Orders with key values 1 and 2 by using the Atom format.

HTTP Request:

POST /service.svc/Customers HTTP/1.1
Host: host
Content-Type: application/atom+xml
Accept: application/atom+xml
Content-Length: nnn

<?xml version="1.0" encoding="utf-8"?>
<entry xml:base="http://host/service.svc/"
<title type="text" />
<name />
<link rel="" href="Orders(1)" />
<link rel="" href="Orders(2)" />
<content type="application/xml">
  <d:CompanyName>Contoso Widgets</d:CompanyName>
    <d:Street>58 Contoso St</d:Street>
Closed Jan 15, 2015 at 9:09 AM by lianw
Closed here and moved the issue to GitHub (


HongmeiG wrote Oct 10, 2012 at 9:56 PM

It is a rare error case, and we can add validation post build.

kichalla wrote Oct 11, 2012 at 2:47 PM

I do not agree that this is a rare case. This kind of scenario is common in relational data.

We cannot create an Order without associating it with an existing Customer. So validating here for atleast presence of the relational links in the incoming Order is a natural thing to do.