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

  • SEARCH
  • Home
  • 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 5948781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:09:26+00:00 2026-05-22T17:09:26+00:00

I currently have an MVC website and am about to create an API to

  • 0

I currently have an MVC website and am about to create an API to expose limited functionality to a mobile client. My site has a logic layer where I have DTOs that I use to display information on the site.

When creating an API, should I expose these same DTOs to the client or should I create DTOs specific for use in the API? I will be creating new controllers and action methods, so might make sense to also create API-specific DTOs.

I feel that creating an API forces you into a contract with the mobile client so that changes are harder to make. Having separate DTOs allows you to freely make changes to DTOs that are only used on the site.

However, the down side is that I am basically duplicating my code, since the DTOs will basically be the same.

Thoughts?

  • 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-05-22T17:09:26+00:00Added an answer on May 22, 2026 at 5:09 pm

    IMO, Decision on this would mainly be guided by what all data do I need to pass to the view, if its the same in both cases, I would go with the same DTOs. If this is not the case, then I would create a base class for a DTO which has the common stuff across APIs for a particular view, and inherit from that base DTO and add more properties in the derived class specific to the API needs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a website which has a WebForms 4 site. This website is
I'm currently writing a website in ASP.NET MVC, and my database (which doesn't have
I am currently creating an e-commerce site using C# ASP.NET MVC and have just
I have simple jQuery Mobile site created using asp.net mvc 2 and uses basic
Currently I have a pure silverlight website with navigation. Im worried about the customers
I have a Spring 3 MVC website using Spring Security 3.1.0RC2. Currently I am
I'm developing MVC engine for real estate web-site from scratch. Currently I have this
Does anyone have any information about getting the current versions of ASP.NET MVC (Preview
I am currently building a custom Membership Provider for my Asp.net MVC website. I
I have an ASP.NET MVC (Beta 1) website that I'm using themes with. When

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.