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
personService.getPerson(
{
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
Hi,
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="https://github.com/aspnetboilerplate/aspnetboilerplate/tree/master/src/Abp/Application/Services/Dto">https://github.com/aspnetboilerplate/as ... rvices/Dto</a>)
To send a single Id as input, you can use EntityRequestInput for example.