Handling Relationships Between Entities

In the current example, the Customer and Order entities have a one-to-many relationship in which one customer can have many orders. In OData terminology, relationships are referred to as references. References are automatically managed by the .NET Framework, except when you create a new object and you must add a relationship, or when you update a relationship on an existing object. These situations are respectively represented by POST and PUT verbs. Suppose you want to handle situations in which you add new orders or update existing orders. In the OrdersController class, you need to add the following method (pay attention to the comments):

<AcceptVerbs("POST", "PUT")>Public ...

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.