Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add InferPathParameterBindingSources method to AbpServiceConvention. #17260

Closed
wants to merge 3 commits into from

Conversation

maliming
Copy link
Member

@maliming maliming commented Aug 3, 2023

ASP NET Core will not set {assignToId?} binding source as Path by default.
We have to specify FromRoute for nullable assignToId manually.

This pr automatically sets the binding source to Path for parameters if the controller inherits AbpControllerBase and IApplicationService.

This is mainly designed for the HttpApi layer of the module.

[Route("api/identity/roles")]
public class TestHttpApiController : AbpControllerBase, IApplicationService
{
    [HttpDelete]
    [Route("{id}/assign/{assignToId?}")]
    public virtual Task DeleteAsync(Guid id, Guid? assignToId)
    {
        return Task.CompletedTask;
    }
}

@maliming maliming added this to the 7.4-preview milestone Aug 3, 2023
@maliming maliming changed the title Add AbpApiBehaviorApplicationModelProvider. Parameter with a name that appears as a route value in any route template is assigned BindingSource.Path. Aug 3, 2023
@maliming maliming marked this pull request as ready for review August 3, 2023 05:32
@codecov

This comment was marked as resolved.

@maliming maliming force-pushed the AbpApiBehaviorApplicationModelProvider branch from 53861a2 to e9088e4 Compare August 3, 2023 06:38
@maliming maliming requested a review from hikalkan August 3, 2023 06:56
@maliming maliming changed the title Parameter with a name that appears as a route value in any route template is assigned BindingSource.Path. Add InferPathParameterBindingSources method to AbpServiceConvention. Aug 3, 2023
@maliming maliming removed the request for review from hikalkan August 3, 2023 08:14
@maliming maliming modified the milestones: 7.4-preview, backlog Aug 3, 2023
@enisn enisn closed this Oct 23, 2023
@enisn enisn deleted the AbpApiBehaviorApplicationModelProvider branch October 23, 2023 09:14
@hikalkan hikalkan removed this from the backlog milestone Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants