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 3624126
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:28:08+00:00 2026-05-18T23:28:08+00:00

I am in the process of designing an API. I would like to know

  • 0

I am in the process of designing an API. I would like to know if what I have come up with is a good solution:

I have a respository type of data layer that talks to a database by converting business classes into entities(generated from LLBL GEN, I didn’t want to use the entities directly as my business objects because I wanted to keep them simple and allow me to swap out to Entity Framework or some other mapper is I needed to)

I have a WCF service layer that I’m using as a type of facade. It calls the respository layer and converts the business objects to DTOs and passes them through the API service call via a message to the client. The client can be an ASPX website, Silverlight app, WPF app, or even a WP7 app. The problem I keep runnnig into is when I want to run business logic I have to send the DTO back to the WCF service and then back to the client. This doesn’t seem “right” to me. I can’t put business logic in the DTO because that defeats the purpose. But if I want business type code to run on the client I have a lot of duplication of code throughout my different clients.

My business layer does not know of the data layer, my data layer knows of the business layer and my facade layer knows of the data layer and the business layer and the DTOs. Is this a bad design for an API? And can anyone offer me any suggestions? I have only learned of enterprise level apps through reading different articles online.

Thanks!

  • 1 1 Answer
  • 3 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-18T23:28:09+00:00Added an answer on May 18, 2026 at 11:28 pm

    Relations between layers

    If I understand your design well, the business layer does not know of (=does not use) the data layer, and the facade actually interconnects them by translating DAOs into DTOs and vice-versa.

    You should consider a rather different approach: Define interfaces for all data-related objects (regardless if DAOs or DTOs) and use an Inversion-of-Control container to weave the business layer and data access layer together. The reason is that in your design you might quickly run into the inability to retrieve additional data in right in the business layer. You’d end up with the facade substituting this lack and hence doing too much actual business logic.

    In case you make a clear connection between the business layer and the underlying data layer, while separating them with well-designed interfaces and an IoC container, you prevent this problem while maintaining good and concise internal design.

    Usage of DTOs

    I think it’s alright that you have to pass the DTOs back to the back-end of your app. In your case the purpose of DTOs is (1) to supply information for the presentation layer, and (2) to provide a way of passing modified or new data to the back-end for further processing. DTOs for cases (1) and (2) need not be the same. Hence if it makes sense, you can pass to the back-end just a DTO representing a subset of the whole information.

    However, the back-end shall return a new DTO after processing, which, again, needs not to be the same DTO as the input DTO. This way the presentation layer can easily adapt to changes made by the back-end into related parts of the whole object.

    Imagine a simple Get / Update API such as this one:

    CustomerDTO GetCustomer(int customerID);
    
    CustomerDTO UpdateCustomerAddress(int customerID, AddressDTO address);
    
    CustomerDTO UpdateCustomerPrimaryContact(int customerID, PersonDTO primaryContact);
    

    You are using an ID to identify a customer and passing in a DTO that represents a subset of the customer record to be updated (regardless of the underlying data architecture). The out DTO represents the customer as a whole, simplifying the presentation-layer’s task of updating the information shown to the user. The advantage is the back-end does not need to know which subset of customer data the presentation layer actually needs, and the presentation layer can pass the back-end only those parts that were really modified.

    Update — technical note: Consider using a tool like AutoMapper (C#) to automate translations between DTOs and DAOs. While this matter is a subject of technology used, generally this approach saves a lot of manual work and is able to eliminate hard-to-discover bugs. Having such an object translation automation in place helps promote better design practices and allows you to produce more-specialized and hence semantically more accurate DTOs.


    Disclaimer: While this is a rather general question, my recommendations may not seem right in respect to further details of your application which are not covered in your question.

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

Sidebar

Related Questions

In the process of designing an application we've come to the conclusion that the
I have a Rails application that I'm in the process of designing. I have
I would like to take data from the Facebook Graph API and analyze it
I'm designing a framework and in the process I have come across an interesting
I am in the process of designing a web interface that would support 2
I'm in the process of designing an API in PHP that will use OAuth2.0.
I'm in a process of designing a multi-tier ASP.NET web application that is supposed
I'm designing a new web application and I'm aware that the process of registration
I'm in the process of designing a .NET API to allow developers to create
I am in process of designing my CMS that I am about to create.

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.