Data points: Designing an Entity Data Model

Source: Internet
Author: User

The Entity Framework is an exciting new technology developed for Ado.net. It enables developers to view data using logical models rather than physical models, and provides greater flexibility.

The core of the Entity Framework is the Entity Data Model (EDM). An EDM defines the entity types, relationships, and containers that developers interact with through code. The Entity Framework maps these elements to the storage schemas exposed by the relational database. The EDM is exposed to the Entity Framework through XML that defines the conceptual application model. The conceptual model can be defined individually or together with the XML that defines the actual storage schema and the XML that defines the mapping between the two. Although it is possible (and sometimes necessary) to edit the XML manually, it is easier to create and modify entity models and mappings using the new visual Entity Data Model Designer tool.

In this month's column, we'll discuss how to use the new Visual EDM Designer tool to design the entity model, and how to modify the underlying XML that defines the model and mappings. I'll start with the various aspects of interacting in the Entity Framework (including LINQ), and then discuss where the EDM is suitable for use. In addition, you will demonstrate how to use the visual designer tools to create entity models and associated mappings. Finally, you will be presented with several windows that can help you modify and explore your models and mappings.

Throughout the column, I'll explain the role of different components of the EDM (such as EntityType and association). The examples in this column show how to create a basic entity. Please note that all of the examples in this column use Visual studio®2008 and the corresponding Entity Framework Beta 3 (these need to be installed separately). The database that I use is a modified Northwind sample database that contains the samples in Beta 3.

Understanding EDM

Before exploring how to create and manage an entity model, first describes what an EDM is and how it interacts with other elements of the Entity Framework. The Entity Framework consists of many parts, including the EDM specification and associated mappings, APIs interacting with the EDM, and tools to help define and manage entity models and mappings. After you design an entity model, you can use different APIs to write code based on the entity model, such as the EntityClient provider or the object service (including LINQ to entities).

The EntityClient data provider has a model similar to a traditional Ado.net object because it returns DbDataReader using EntityConnection and EntityCommand objects. The EntityClient provider's commands are written using Entity SQL similar to T-SQL that operates on entities defined in the entity model and objects that are materialized through object Services, rather than database objects. You can use Object Services to interact with the EDM through entity SQL or LINQ to Entities. With Object Services, you can take advantage of the conceptual model's build classes, which provide attributes such as strongly typed objects and persistence (see Figure 1).

Figure 1 Overview of the Entity Framework

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.