# N-tier Architecture

An N-tier architecture divides an application into **logical layers** and **physical tiers**.

* A higher layer can use services in a lower layer.

An N-tier application can have:

* a **closed layer architecture**, a layer can only call the next layer immediately down.
* an **open layer architecture**, a layer can call any of the layers below it.

A three-tier architecture includes:

* Data Access Layer — responsible for data processing
* Business Logic Layer — responsible for app logic
* Presentation Layer — responsible for the display (UI, Web API).

The main problem with this architecture is that all layers are built on top of the Data Access Layer and are, in fact, tied to a certain type of data storage. If this type changes, it causes changes at all levels. The Entity Framework partially solves this problem, but it supports a limited number of database types.

To overcome this issue we use Onion Architecture.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dailyjournal.gitbook.io/notes/software-development/software-design-patterns/architectural-patterns/n-tier-architecture.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
