Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Dynamic Web API Parameter binding #294


User avatar
0
rahulbpatel created

How are parameters bound from the dynamic Web API layer to application service? Do we have to use DTOs for all input/output values or is it possible to use asimple types? I've defined an application service method as so:

Task<ListDto> GetByName(string name);

I'm trying to invoke it in AngularJS with the following call:

listAppService.getByName({name: 'States'})

This is resulting in the following error response:

{"success":false,"result":null,"error":{"code":0,"message":"Your request is not valid!","details":null,"validationErrors":[{"message":"name is null!","members":["name"]}]},"unAuthorizedRequest":false}

1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Dynamic Web API currently only allows DTOs, not primitives. It uses ASP.NET Web API's default binding actually. But there are some problems with primitives. It will be fixed soon. But anyway I suggest DTOs as a better practice.