Class EndpointWithoutRequest<TResponse, TMapper>
use this base class for defining endpoints that doesn't need a request dto but return a response dto and uses a response mapper.
Inheritance
Inherited Members
Namespace: FastEndpoints
Assembly: FastEndpoints.dll
Syntax
public abstract class EndpointWithoutRequest<TResponse, TMapper> : EndpointWithoutRequest<TResponse>, IEndpoint, IEventBus, IServiceResolverBase, IHasMapper<TMapper>, IHasMapper where TResponse : notnull where TMapper : IResponseMapper
Type Parameters
Name | Description |
---|---|
TResponse | the type of the response dto |
TMapper | the type of the entity mapper |
Properties
Map
the entity mapper for the endpoint
HINT: entity mappers are singletons for performance reasons. do not maintain state in the mappers.
Declaration
public TMapper Map { get; set; }
Property Value
Type | Description |
---|---|
TMapper |
Methods
SendMappedAsync<TEntity>(TEntity, int, CancellationToken)
send a response by mapping the supplied entity using this endpoint's mapper's ASYNC mapping method.
Declaration
protected Task SendMappedAsync<TEntity>(TEntity entity, int statusCode = 200, CancellationToken ct = default)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | the entity instance to map to the response |
int | statusCode | the status code to send |
CancellationToken | ct | optional cancellation token |
Returns
Type | Description |
---|---|
Task |
Type Parameters
Name | Description |
---|---|
TEntity | the type of the entity supplied |
SendMapped<TEntity>(TEntity, int, CancellationToken)
send a response by mapping the supplied entity using this endpoint's mapper's SYNC mapping method.
Declaration
protected Task SendMapped<TEntity>(TEntity entity, int statusCode = 200, CancellationToken ct = default)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | the entity instance to map to the response |
int | statusCode | the status code to send |
CancellationToken | ct | optional cancellation token |
Returns
Type | Description |
---|---|
Task |
Type Parameters
Name | Description |
---|---|
TEntity | the type of the entity supplied |