Implementing Queries

Every auto-generated method name recalls an HTTP action; for instance, the CustomerController class has GetCustomers to return the list of customers, PostCustomer to add a new customer, PutCustomer to edit an existing customer instance, and so on. This works in a classic Web API scenario, but an OData service requires method names to exactly match HTTP verbs. In addition, you need to change method bodies that include code that is specific to Web API and not to OData.

The first thing you change is the Get action. You see two methods, GetCustomers (which returns the full list of customers) and GetCustomer (which returns a single customer instance). Both names must be replaced with Get, which matches the same-named HTTP verb. ...

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.