is it possible to have an api endpoint whose method's sign can accepts a parameter that can be a single object or a collection of objects?
i have a method like this:
[HttpPost, Route("DoSomething")]
public async Task<IHttpActionResult> DoSomething([FromBody] MyType xxx, CancellationToken cancel)
i need to modify this method to accept a collection of MyType class (an array, enumerable, list... doesn't matter)
[HttpPost, Route("DoSomething")]
public async Task<IHttpActionResult> DoSomething([FromBody] IEnumerable<MyType> xxx, CancellationToken cancel)
anyway for a little while the client that calls this endpoint will continue to send me a single object { } and not a collection of objects [{ },{ }]
is it possible to modify this endpoint to accept both types?