Open Closed

Pass Parameter to DynamicWebApi #155

behiunforgiven created

I have a service Like this

PersonDto GetPerson(GetPersonInput input);

GetPersonInput is a DTO that only have an id (int)

public class GetPersonInput : IInputDto
       public int id {get; set;}

and my angular code is like this

                        id : $scope.pId
                    .success(function (data) {
                       //some code

There is no problem in this case but when i change my service like this

PersonDto GetPerson(int id);

i get an error that 'id' is not passed !

Is it necessary to use InputDto in the services?

1 Answer(s)
  • 0
    hikalkan created
    Support Team


    Yes, it's best practices and currently it's necessary. I planned to allow primitive types in parameters. You can use some pre-built DTOs those can make easy for such cases. Check DTO classes in Abp.Application.Services.Dto namespace (<a class="postlink" href=""> ... rvices/Dto</a>)

    To send a single Id as input, you can use EntityRequestInput for example.