Skip to content

Architecture Overview

Jon Smith edited this page Feb 5, 2015 · 7 revisions

GenericServices is here to help you build a Service Layer, sometime called an Application Layer, in your application. I explain why this is useful in the following section in the in the Why GenericServices? page. The diagram below gives you an overview of the recommended architecture.

GenericServices recommended architecture

Full description of the recommended architecture

In my Simple-Talk article Using Entity Framework with an Existing Database: User Interface I explain in detail the sort of application architecture that GenericServices is designed to work in. I recommend anyone who wants a good understanding of GenericServices to read that article.

You can also get a good idea of the architecture by looking at the example web sites listed at the top of the Wiki index.

Short version of the recommended architecture

  1. Data Layer: sometimes called the Infrastructure Layer, or Persistence Layer. This deals with the reading and writing data to the database using EF. It should provide IQueryable versions of each table/class for reading.
  2. Business Layer. This will contain all the business logic that goes beyond simple read/write of data. The Business Layer accesses the database via the data layer, using either EF commands directly or some form of Repository/UnitOfWork pattern. See my blog article Is the Repository pattern useful with Entity Framework? for my views on that.
  3. Service Layer: sometimes called the Application layer. This layer's job is to format the data flowing from the Data Layer and the Business Layer to/from the format that the Presentation Layer needs. This is where GenericService and the associated DTOs are defined to handle the Data Layer to Presentation Layer communication.
  4. Presentation Layer: sometimes called the UI (User Interface) Layer. This section’s job is to present the formatted data from the Service Layer to either a user via a web page, to another system via say a RESTful interface.

NOTE. GenericServices is designed to be easy to use with Dependency Injection (DI), which is a way of linking to services. See the section Dependency Injection page in the Wiki for full details of how it is implemented in the SampleMvcWebApp.

Clone this wiki locally