Implementing and Consuming Functions

OData services can expose functions. A function executes server-side operations and returns a result to the client. A function must be registered in the service configuration and must be implemented in the controller class that refers to the entity that the function works on. For example, suppose you want to execute a server-side query that returns the most recent order and that returns the result to caller clients. The function will work with the Order entity, and so it will be placed in the OrdersController class. In this controller, write the following code:

<HttpGet> <EnableQuery>Public Function MostRecentOrder() As IHttpActionResult    Dim maxDate = db.Orders.Max(Function(o) ...

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.