Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of DTO in 3 tier architecture [closed]

Tags:

c#

dto

3-tier

I am using simple 3 tier architecture. In this I am using DTO classes to communicate between UI,BL and DL. So there is any better way for communication between layers? or this is the right way?

like image 812
0cool Avatar asked Sep 20 '12 05:09

0cool


People also ask

What is a 3 tier architecture in DBMS?

The 3-tier architecture refers to the logical 3-tier system rather than the physical ones. It adds a “middle tier” between the client and the database. The main functions and business logic of the system are processed in the middle layer, which is the application layer.

What are the three tiers of an architecture?

It divides the architecture into three tiers: data layer, application layer, and presentation layer. The 3-tier architecture refers to the logical 3-tier system rather than the physical ones.

What is a 3-tier architecture pattern?

A 3-tier architecture is an architecture pattern used in applications as a specific type of client-server system. It divides the architecture into three tiers: data layer, application layer, and presentation layer. The 3-tier architecture refers to the logical 3-tier system rather than the physical ones.

What is a three-tier application?

In a three-tier application, all communication goes through the application tier. The presentation tier and the data tier cannot communicate directly with one another. In discussions of three-tier architecture, layer is often used interchangeably – and mistakenly – for tier, as in 'presentation layer' or 'business logic layer.'


1 Answers

DTO, Data transfer Object, is the concept for distribution layer, you use when transferring data between your consumers and your service. So, if you don't publish any service, get off DTO.

To answer your question, it also depends on how complex your application is. If it's simple, just use CRUD operation, or you can even use DataTable, DataSet for communication.

Otherwise, Domain Entity from DDD is the core object for communication between layers: Data Access Layer, Business Logic Layer and Presentation Layer.

Basically, there are some different type of objects in application:

  1. DTO, use when you public services, main object to communicate between consumer and your service.
  2. View Model, object in presentation layer to support UI.
  3. Domain Entity is from Business logic layer to contain business logic.

Be careful with the term:

  1. Tier: it means physical, like database server, web server.
  2. Layer: it means logical layer: Persentation Layer, Business Logic Layer, Data Access Layer.
like image 150
cuongle Avatar answered Sep 19 '22 16:09

cuongle