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

Support a wrapper type for binding to parameters from form values #17

Open
DamianEdwards opened this issue Mar 22, 2022 · 0 comments
Open

Comments

@DamianEdwards
Copy link
Owner

e.g.

app.MapPost("/todos", (FormData<Todo> form) =>
{
    var todo = form.Value;
    // Do something with your todo here
});

public record Todo(int Id, string Title, bool IsComplete);

Can do this using MVC's binder via ModelBinder<T> now but obviously it uses MVC under the covers. A lighter weight option could be nice, although I'd need to decide how much of MVCs behavior to replicate and it's pretty complicated. Perhaps we could borrow some logic from the Options<T> configuration binding in Microsoft.Extensions.

DamianEdwards added a commit that referenced this issue Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant