minimal api-- FromQuery problem for complex object
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
## Background and Motivation
when i use web api (mvc)
```
public class ShoppingCartController : Controller
{
[HttpGet]
[Route("estimate/{sku}/{shoppingCartId?}")]
public async Task> EstimateProductAsync(
string sku,
string? shoppingCartId,
[FromQuery] Address? shipping,
[FromQuery] Address? billing
)
)
```
everything is working as expected.
=========
but when i use minimal api, got exception
```
public static IEndpointRouteBuilder AddEstimateProductAsyncEndpoint(this ```
IEndpointRouteBuilder builder)
{
builder.MapGet("api/ShoppingCart/EstimateProduct/{sku}/{shoppingCartId}", EstimateProductAsync)
.AllowAnonymous()
.DisableAntiforgery();
return builder;
}
private static async Task EstimateProductAsync(
string sku,
string? shoppingCartId,
[FromQuery] Address? shipping,
[FromQuery] Address? billing
)
```
which indicated both [FromQuery] Address? shipping,
[FromQuery] Address? billing are UNKNOWN AND SHOULD HAVE TryParce method
## Proposed API
minimal api should be better than mvc api , at least the same
Contributor guide
Assessment
This issue has not been assessed yet.