everyone!
I've recently tried to use ServiceStack framework and bumped into the following unclearance.
Can I or I can not do the following with that library:
public class userService : Service
{
public object Get(int? userId)
{
// instead of receiving user request object (empty or filled only with its id property)
return new userResponse();
}
}
Another thing is weird for me with the whole DTO/Request/Response classes logic, i.e., I should define three classes, which start with similar name ("user" for instance), plus, the service which processes the DTO is found by parameter(!) (Get(user request)). Am I right? Or this is just because I am not fully understand the logic of ServiceStack? If so, then that's pretty inconvenient. That looks pretty weird when Service endpoint (service action) is defined on DTO(!) but not service class initially. Is it possible to do something like this in any way?:
[Route("/users")]
public class userService : Service
{
public object Get()
{
return new ResponseBase(new List<Users>());
}
public object Get(int id)
{
return new ResponseBase(new User());
}
}
That looks like mostly a la ASP.NET Web API. However, then a question appears. Why ServiceStack is for? Is it just because it was created earlier?
Thank you!