Skip to content

Web Service Controllers

Steve Ives edited this page May 26, 2020 · 1 revision

Harmony Core Logo

Web Service Controllers

(coming soon)

Web API Controllers

(coming soon)

OData Controllers

Microsoft.AspNet.OData.ODataController is the base class for controllers in OData. Methods that you want to be routable should be public, and generally should be named based on the HTTP verb you will use to call it. Dependency injection is supported for controller constructors, which means you can declare dependencies as parameters to your public constructor method. If requests for those types can be satisfied by the IServiceProvider your constructor will be called with, those parameters fill out. The following is an example method that will be invoked when the controller is called using HTTP GET without any parameters:

{ODataRoute("Orders")}
{EnableQuery(MaxExpansionDepth=3, MaxSkip=10, MaxTop=5, PageSize=4)}
public method Get, @IActionResult
proc
    mreturn Ok(DBContext.Orders)
endmethod

The above is also an example of how you can provide an explicit route path and enable (and control) the way the underlying framework can satisfy OData queries.

Clone this wiki locally