Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9054673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:44:53+00:00 2026-06-16T13:44:53+00:00

I am unable to find documentation (Clear or otherwise) that explains how to implement

  • 0

I am unable to find documentation (Clear or otherwise) that explains how to implement a Service in Service Stack with multiple methods. All examples show a service class with one method only. I cant imagine if you have a service with 4+ methods, that your really need to make 4+ service classes, 4+ Request DTO’s and 4+ response DTO’s. ( As shown here )

Example:

A Service with 4 Search methods ( method(Identifer1), method2(identifer2), method3(identifer3))

Based on the documented structure of a Request DTO ( Service Stack Wiki , and Creating your First Web Service ) , The Request DTO’s Class Attributes, Control the Routing to the Service Class, (If I understood that correctly, but again I am looking for Documentation or an example)

The documentation on routing is a little fuzzy, as most examples do not follow the defined naming convention for Request/Response DTo’s as outlines in the “Your First Web Service Explained“

I have also read this SO Post, but the I am left with the same questions after following the advice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:44:54+00:00Added an answer on June 16, 2026 at 1:44 pm

    I cant imagine if you have a service with 4+ methods, that your really need to make 4+ service classes, 4+ Request DTO’s and 4+ response DTO’s.

    No you need 1 service class with 4 methods – each method of course taking a request Dto and returning a Response Dto. Obviously for some methods you might not need a response Dto

    For example, here’s how a typical service with 5 methods might look like:

    public class ProductsService: Service
    {
        [Route("/products")]
        public class GetProductsRequest: IReturn<List<ProductResponse>> {}
    
        public class ProductResponse
        {
            public int Id { get; set; }
            public string Name { get; set; }
        }
    
        public object Get(GetProductsRequest request)
        {
            IEnumerable<ProductResponse> response = ...
            return response;
        }
    
        [Route("/products/{id}")]
        public class GetProductRequest: IReturn<ProductResponse> 
        {
            public int Id { get; set; }
        }
    
        public object Get(GetProductRequest request)
        {
            ProductResponse response = ...
            return response;
        }
    
        [Route("/products")]
        public class CreateProductRequest 
        {
            public string Name { get; set; }
        }
    
        public object Put(CreateProductRequest request)
        {
            ... create the product here
            return new HttpResult { StatusCode = HttpStatusCode.Created };
        }
    
        [Route("/products/{id}")]
        public class UpdateProductRequest
        {
            public int Id { get; set; }
            public string Name { get; set; }
        }
    
        public object Patch(UpdateProductRequest request)
        {
            ... update the product here
            return new HttpResult { StatusCode = HttpStatusCode.Accepted };
        }
    
        [Route("/products/{id}")]
        public class DeleteProductRequest
        {
            public int Id { get; set; }
        }
    
        public object Delete(DeleteProductRequest request)
        {
            ... delete the product here
            return new HttpResult { StatusCode = HttpStatusCode.Accepted };
        }
    }
    

    I’ve put the Request and Response DTOs as nested classes to the service, but it would make it more readable to have them in separate files:

    public class ProductsService: Service
    {
        public object Get(GetProductsRequest request)
        {
            IEnumerable<ProductResponse> response = ...
            return response;
        }
    
        public object Get(GetProductRequest request)
        {
            ProductResponse response = ...
            return response;
        }
    
        public object Put(CreateProductRequest request)
        {
            ... create the product here
            return new HttpResult { StatusCode = HttpStatusCode.Created };
        }
    
        public object Patch(UpdateProductRequest request)
        {
            ... update the product here
            return new HttpResult { StatusCode = HttpStatusCode.Accepted };
        }
    
        public object Delete(DeleteProductRequest request)
        {
            ... delete the product here
            return new HttpResult { StatusCode = HttpStatusCode.Accepted };
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm unable to find documentation that fully explains entities being deleted from datastore (I'm
Netty channels have multiple states but I am unable to find any documentation on
I've been unable to find documentation that would let me combine the look of
I have been unable to find any documentation on the .build method in Rails
I have been unable to find any documentation on properly closing database connections in
I have been unable to find any decent documentation on this function. The code
Does anyone have experience with Sparse ? I seem unable to find any documentation,
I am unable to find any documentation on how to do what has been
I am unable to find good documentation about how to subclass NSOperation to be
I'm unable to find any documentation where I can find a code example for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.