Definition
Assembly: Microsoft.Restier.AspNet.dll Namespace: Microsoft.Restier.AspNet Inheritance: Microsoft.AspNet.OData.ODataControllerSyntax
Summary
The all-in-one controller class to handle API requests.Constructors
.ctor
Initializes a new instance of the RestierController class.Syntax
Remarks
Please note that this controller needs a few dependencies to work correctly. The second constructor with arguments specifies those dependencies. When using the constructor without arguments, a DI container is requested from the HttpRequestMessage and the dependencies are resolved at run time. It is better to use a DI framework and register RestierController yourself to allow the DI container to explicitly resolve dependencies at the start of your application. It is possible that the default constructor will be removed in the future..ctor
Initializes a new instance of the RestierController class.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
querySettings | Microsoft.AspNet.OData.Query.ODataQuerySettings | OData Query settings for queries. |
validationSettings | Microsoft.AspNet.OData.Query.ODataValidationSettings | OData validation settings for validation. |
operationExecutor | Microsoft.Restier.Core.Operation.IOperationExecutor | An Operation Executer to execute operations. |
Methods
Delete
Handles a DELETE request to delete an entity.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
cancellationToken | System.Threading.CancellationToken | The cancellation token. |
Returns
Type:System.Threading.Tasks.Task<System.Web.Http.IHttpActionResult>
The task object that contains the deletion result.
Get
Handles a GET request to query entities.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
cancellationToken | System.Threading.CancellationToken | The cancellation token. |
Returns
Type:System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
The task object that contains the response message.
Patch
Handles a PATCH request to partially update an entity.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
edmEntityObject | Microsoft.AspNet.OData.EdmEntityObject | The entity object to update. |
cancellationToken | System.Threading.CancellationToken | The cancellation token. |
Returns
Type:System.Threading.Tasks.Task<System.Web.Http.IHttpActionResult>
The task object that contains the updated result.
Post
Handles a POST request to create an entity.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
edmEntityObject | Microsoft.AspNet.OData.EdmEntityObject | The entity object to create. |
cancellationToken | System.Threading.CancellationToken | The cancellation token. |
Returns
Type:System.Threading.Tasks.Task<System.Web.Http.IHttpActionResult>
The task object that contains the creation result.
PostAction
Handles a POST request to an action.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
parameters | Microsoft.AspNet.OData.ODataActionParameters | Parameters from action request content. |
cancellationToken | System.Threading.CancellationToken | The cancellation token. |
Returns
Type:System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
The task object that contains the action result.
Put
Handles a PUT request to fully update an entity.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
edmEntityObject | Microsoft.AspNet.OData.EdmEntityObject | The entity object to update. |
cancellationToken | System.Threading.CancellationToken | The cancellation token. |
Returns
Type:System.Threading.Tasks.Task<System.Web.Http.IHttpActionResult>
The task object that contains the updated result.