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

提供绑定器对 FromQuery,FromHeader,FromRoute 的原生支持! #6

Open
vipwan opened this issue Oct 10, 2023 · 1 comment
Open
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@vipwan
Copy link
Owner

vipwan commented Oct 10, 2023

    public class HelloApiRequest : BaseRequest<HelloApiRequest>
    {
        public string? Name { get; set; } = "default";

        [AliasAs("a")]
        public string? Alias { get; set; }

        [FromQuery]
        public string? Q { get; set; }

        [FromServices]
        public IService Svc  { get; set; }

        public HelloApiRequest()
        {
            RuleFor(x => x.Name).NotNull().Length(2, 36);
        }
    }

如果指定了绑定来源那绑定器会自动定位来源, 如果未指定来源, 绑定器将 从 Query&Body&Head&Route等依次匹配(原有模式匹配)

vipwan added a commit that referenced this issue Oct 10, 2023
vipwan added a commit that referenced this issue Oct 10, 2023
@vipwan vipwan added the enhancement New feature or request label Oct 12, 2023
@vipwan
Copy link
Owner Author

vipwan commented Oct 18, 2023

#14 现在支持复杂的绑定

@vipwan vipwan added the help wanted Extra attention is needed label Oct 18, 2023
@vipwan vipwan added this to the 丰富Req绑定支持 milestone Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant