Skip to content

OData batching does not deserialize complex types in controller post actions #1172

Answered by gathogojr
levelnis asked this question in Q&A
Discussion options

You must be logged in to vote

@levelnis I was unable to reproduce the issue with the following minimal repro:

// Data models
namespace NS.Models
{
    public class Thing
    {
        public int Id { get; set; }
        public List<Item> Items { get; set; }
    }

    public class Item
    {
        public int Id { get; set; }
        public string Description { get; set; }
    }
}

// Controller
public class ThingsController : ODataController
{
    [HttpPost("Things/{id:guid}/Items")]
    [Consumes("application/json")]
    public async Task<IActionResult> PostItemAsync([FromRoute] Guid id, [FromBody] NS.Models.Item item, ODataQueryOptions<NS.Models.Item> options)
    {
        return Ok();
    }
}

// Service configu…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@levelnis
Comment options

@gathogojr
Comment options

Answer selected by levelnis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants