Data points: An Entity Framework in a hierarchical architecture

Source: Internet
Author: User

This column is based on a pre-release version of Ado.net EntityFramework. All the information contained in this article may be changed.

Directory

Definition Layer

Building Models

Working principle

Keep changing

Delete and add

Summarize

When an n-tier architecture architect evaluates any new technology, pattern, or strategy, they must consider how the new puzzle will merge with the architecture. With the Entity Framework, integration will no longer be a problem. It can be integrated into an n-tier architecture as well as a single tier architecture.

In this month's column, I'll explain how to make the Entity Framework suitable for using windows®communication Foundation (WCF), Windows presentation Foundation (WPF) technology, and Model View P N-tier architecture for Resenter (MVP) mode. I'll demonstrate a sample architecture that includes a logical storage database tier, a data access layer, a domain model layer, a Business manager layer, a service layer, a presentation layer, and a passive UI layer, and I'll also show you how to use the Entity Framework to integrate these layers. All of the code examples I use can be downloaded from the MSDN® magazine website.

Definition Layer

The application I'm about to show allows users to search for and perform view, add, edit, or delete operations on the NORTHWINDEF sample database. Before delving into the code and the examples, let's discuss the overall architecture of the example. Since my focus is not on the architecture itself, but on how to integrate the Entity Framework with the architecture design, I have chosen a more common architecture that can be easily integrated with other policies after modification.

Figure 1 shows a high-level view of a typical hierarchical architecture. The top two layers use the UI layer and presentation layer to handle user interface representations and navigation. The UI layer can be implemented through a variety of techniques, but in the relevant examples in this column, I will use WPF. The UI layer complies with the MVP mode with the passive view, which means that the view (top UI layer) is managed and controlled by the presentation layer. The presentation is responsible for providing data for these views, extracting data from the view to keep it at a lower level, and, in general, responding to events raised by the view.

Figure 1 Architecture Overview

In the example here, the presentation communicates with a lower layer through WCF. The representation uses the contract of the service as a guide to invoke the service through WCF. The service layer provides services through the service contract interface. With these conventions, the presentation can determine how to invoke the service.

The service layer is responsible for receiving traffic from the representations and invoking the appropriate business layer methods that perform the appropriate business logic and data collection or modification operations. The business layer is the business logic and the location where LINQ to entities code for this project will reside. LINQ to Entities code references the entity model that is generated from the Entity Framework. When you execute a LINQ query, the Entity Framework transforms the LINQ query into a conceptual entity model (an Entity Data model or an EDM), maps entity content to a storage tier, generates SQL queries, and executes against the database.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.