billbogaiv / hybrid-model-binding

Provides the ability to bind models using both ModelBinder and ValueProvider in ASP.NET Core.
MIT License
104 stars 19 forks source link

Extend HybridModelBinderApplicationModelConvention to allow CancellationToken #25

Open bkaid opened 5 years ago

bkaid commented 5 years ago

From #20

When using .AddHybridModelBinder(), this adds a Convention to look for controller-actions which have one complex parameter (i.e. not a string or int) and no currently-assigned BindingSource and assign it with a BindingSource == "Hybrid".

It would be handy for the HybridModelBinderApplicationModel convention to also allow a second parameter to be a CancellationToken to allow the FromHybrid to be removed in this scenario:

public async Task<IActionResult> MyAction([FromHybrid] MyModel myModel, CancellationToken cancellationToken) { }