Skip to content

[Question] Understanding custom typed results #31

@ayuksekkaya

Description

@ayuksekkaya

Hello @mehdihadeli, Thank you for this template. I believe there are many helpful patterns in here. I had a question about the custom TypedResultsExtensions you have. What is the benefit of using InternalProblem UnAuthorizedProblem?

In the CreateProductEndpoint for example, the endpoint is defined as:

async Task<
            Results<CreatedAtRoute<CreateProductResponse>, UnAuthorizedHttpProblemResult, ValidationProblem>
        > Handle([AsParameters] CreateProductRequestParameters requestParameters)
        {

What is the advantage of this over just doing

        async Task<
            Results<CreatedAtRoute<CreateProductResponse>, UnauthorizedHttpResult, ValidationProblem>
        > Handle([AsParameters] CreateProductRequestParameters requestParameters)

With the "UnauthorizedHttpResult" directly from the Results class?

Also can you explain the usage of the "MapCommonEndpoint"? It's not being used, so I am not sure how it fits as opposed to the other "Map" methods

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions