Skip to main content

Definition

Assembly: Microsoft.Restier.AspNet.dll Namespace: Microsoft.Restier.AspNet Inheritance: Microsoft.AspNet.OData.ODataController

Syntax

Microsoft.Restier.AspNet.RestierController

Summary

The all-in-one controller class to handle API requests.

Constructors

.ctor

Initializes a new instance of the RestierController class.

Syntax

public RestierController()

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

public RestierController(Microsoft.AspNet.OData.Query.ODataQuerySettings querySettings, Microsoft.AspNet.OData.Query.ODataValidationSettings validationSettings, Microsoft.Restier.Core.Operation.IOperationExecutor operationExecutor)

Parameters

NameTypeDescription
querySettingsMicrosoft.AspNet.OData.Query.ODataQuerySettingsOData Query settings for queries.
validationSettingsMicrosoft.AspNet.OData.Query.ODataValidationSettingsOData validation settings for validation.
operationExecutorMicrosoft.Restier.Core.Operation.IOperationExecutorAn Operation Executer to execute operations.

Methods

Delete

Handles a DELETE request to delete an entity.

Syntax

public System.Threading.Tasks.Task<System.Web.Http.IHttpActionResult> Delete(System.Threading.CancellationToken cancellationToken)

Parameters

NameTypeDescription
cancellationTokenSystem.Threading.CancellationTokenThe 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

public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> Get(System.Threading.CancellationToken cancellationToken)

Parameters

NameTypeDescription
cancellationTokenSystem.Threading.CancellationTokenThe 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

public System.Threading.Tasks.Task<System.Web.Http.IHttpActionResult> Patch(Microsoft.AspNet.OData.EdmEntityObject edmEntityObject, System.Threading.CancellationToken cancellationToken)

Parameters

NameTypeDescription
edmEntityObjectMicrosoft.AspNet.OData.EdmEntityObjectThe entity object to update.
cancellationTokenSystem.Threading.CancellationTokenThe 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

public System.Threading.Tasks.Task<System.Web.Http.IHttpActionResult> Post(Microsoft.AspNet.OData.EdmEntityObject edmEntityObject, System.Threading.CancellationToken cancellationToken)

Parameters

NameTypeDescription
edmEntityObjectMicrosoft.AspNet.OData.EdmEntityObjectThe entity object to create.
cancellationTokenSystem.Threading.CancellationTokenThe 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

public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAction(Microsoft.AspNet.OData.ODataActionParameters parameters, System.Threading.CancellationToken cancellationToken)

Parameters

NameTypeDescription
parametersMicrosoft.AspNet.OData.ODataActionParametersParameters from action request content.
cancellationTokenSystem.Threading.CancellationTokenThe 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

public System.Threading.Tasks.Task<System.Web.Http.IHttpActionResult> Put(Microsoft.AspNet.OData.EdmEntityObject edmEntityObject, System.Threading.CancellationToken cancellationToken)

Parameters

NameTypeDescription
edmEntityObjectMicrosoft.AspNet.OData.EdmEntityObjectThe entity object to update.
cancellationTokenSystem.Threading.CancellationTokenThe cancellation token.

Returns

Type: System.Threading.Tasks.Task<System.Web.Http.IHttpActionResult> The task object that contains the updated result.