I have a action method which is called with parameters, one parameter is an int
and another parameter to the action method is an Object
.
When I inspect the action method I see that the Object
parameter is not entirely null,
the UserId property of this object is set to a value, e.g. model.UserId = 82
How do I stop ASP.NET from creating the Object? I could hack this by renaming the userId primitive variable to something like paramUserId, but is not ideal.
Here is the action method:
[HttpGet]
public async Task<IActionResult> Select(int userId = 0, ObjectModel model = null)
The url:
https://localhost:5001/[Area]/[Controller]/Select?userId=82
The ObjectModel:
public class ObjectModel
{
public int Id { get; set; }
public int UserId { get; set; }
}