I am trying to implement a custom function in my OData based controller. This function should create a number of test records in the database. The number of test records to be created is passed as parameter. However, I am totally clueless on how to specify the route to this function so that calling it on the client side would actually end up in the function I have implemented in the controller on the server.
public class DocumentsController : ODataController
{
private readonly DS2DbContext _db;
private readonly ILogger<DocumentsController> _logger;
[EnableQuery]
[HttpGet("Documents/CreateTestDocuments(count={count})")]
public IActionResult CreateTestDocuments([FromODataUri] int count)
{
// ...
}
}
All my other OData code is just basic vanilla configuration to call the usual basic entity/property query, creation / patch / deletion controller methods.
I am aware that there is a similar question, but it is two years old and has no answers.
