Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 680 Bytes

README.md

File metadata and controls

36 lines (25 loc) · 680 Bytes

MY.AspNetCore.Mvc.ModelBinding

Extending FromQuery to support comma separated query parameters for Model Binding in ASP.NET Core.

Usage

  • Add Reference MY.AspNetCore.Mvc.ModelBinding package
PM > Install-Package MY.AspNetCore.Mvc.ModelBinding
  • Add MY.AspNetCore.Mvc.ModelBinding to Mvc or MvcCore
using MY.AspNetCore.Mvc.ModelBinding.Extensions;

services
    .AddMvcCore(options =>
    {
        options.ModelBinderProviders.AddFromQueryAsArrayBinding();
    });
  • In Controller
using MY.AspNetCore.Mvc.ModelBinding;

[HttpGet]
public async Task<IActionResult> GetAsync([FromQueryAsArray] string[] includes)
{
    return Ok();
}