Search Results for

    Show / Hide Table of Contents

    Interface IRequestMapper<TRequest, TEntity>

    use this interface to implement a domain entity mapper for your endpoints that only has a request dto and no response dto.

    HINT: entity mappers are used as singletons for performance reasons. do not maintain state in the mappers.

    Namespace: FastEndpoints
    Assembly: FastEndpoints.dll
    Syntax
    public interface IRequestMapper<in TRequest, TEntity> : IRequestMapper, IMapper
    Type Parameters
    Name Description
    TRequest

    the type of request dto

    TEntity

    the type of domain entity to map to/from

    Methods

    ToEntity(TRequest)

    implement this method and place the logic for mapping the request dto to the desired domain entity

    Declaration
    TEntity ToEntity(TRequest r)
    Parameters
    Type Name Description
    TRequest r

    the request dto

    Returns
    Type Description
    TEntity

    ToEntityAsync(TRequest, CancellationToken)

    implement this method and place the logic for mapping the request dto to the desired domain entity

    Declaration
    Task<TEntity> ToEntityAsync(TRequest r, CancellationToken ct)
    Parameters
    Type Name Description
    TRequest r

    the request dto to map from

    CancellationToken ct

    a cancellation token

    Returns
    Type Description
    Task<TEntity>

    UpdateEntity(TRequest, TEntity)

    implement this method and place the logic for mapping the updated request dto to the desired domain entity

    Declaration
    TEntity UpdateEntity(TRequest r, TEntity e)
    Parameters
    Type Name Description
    TRequest r

    the request dto to update from

    TEntity e

    the domain entity to update

    Returns
    Type Description
    TEntity

    UpdateEntityAsync(TRequest, TEntity, CancellationToken)

    implement this method and place the logic for mapping the updated request dto to the desired domain entity

    Declaration
    Task<TEntity> UpdateEntityAsync(TRequest r, TEntity e, CancellationToken ct)
    Parameters
    Type Name Description
    TRequest r

    the request dto to update from

    TEntity e

    the domain entity to update

    CancellationToken ct

    a cancellation token

    Returns
    Type Description
    Task<TEntity>
    In this article
    Back to top Developed by Đĵ ΝιΓΞΗΛψΚ and contributors / Licensed under MIT / Website generated by DocFX