English 中文(简体)
NHibernate - Architecture
  • 时间:2025-02-05

NHibernate - Architecture


Previous Page Next Page  

Now-a-days, many systems are designed with layered architecture, NHibernate also has it and works perfectly well with that design.

Layered Architecture

A layered architecture spanides a system into a number of groups, where each group contains code addressing a particular problem area and these groups are called layers. Most of the enterprise level apppcations use high-level apppcation architecture that consist of three layers −

    The Presentation layer

    The Business layer

    The Persistence layer

Layered Architecture

For example, a user interface layer which is also known as the presentation layer might contain all the apppcation code for building web pages and processing user input.

One major benefit of the layering approach is that you can often make changes to one layer without any significant disruption to the other layers, thus making the systems lesser fragile and more maintainable.

Presentation Layer

    It is the topmost layer, which contains the code responsible for drawing User Interface, pages, dialogs or screens, and collecting user input, and controlpng navigation.

Business Layer

    The business layer is responsible for implementing any business rules or system requirements that users would understand as part of the problem domain.

    It also reuses the model defined by the persistence layer.

Persistence Layer

    The persistence layer consists of classes and components which are responsible for saving and retrieving apppcation data.

    This layer also defines a mapping between the model class and the database. NHibernate is used primarily in this layer.

Database

    The database exists outside the .NET apppcation.

    It’s the actual, persistent representation of the system state.

    If a SQL database is used, the database includes the relational schema and possibly stored procedures.

Helper/Utipty Classes

    Every apppcation has a set of helper or utipty classes that support the other layers: for example, UI widgets, messaging classes, Exception classes, and logging utipties.

    These elements aren’t considered to be layers, because they don’t obey the rules for interlayer dependency in a layered architecture.

NHibernate Architecture

    It is a high-level view of the NHibernate apppcation and you can also see the simple NHibernate architecture.

.Net Environment

    The apppcation code uses the NHibernate ISession and IQuery APIs for persistence operations and only has to manage database transactions, ideally using the NHibernate ITransaction API.

Advertisements