Entity Framework learning basics 1--ef overview Guide

Source: Internet
Author: User

I recently studied Microsoft's ef. After studying this time, I feel that this EF is not perfect yet. However, it is said that in. net4.0, Microsoft will recommend this framework and improve it. In addition, all databases now support EF. Therefore, you can study the following for future technical preparations. However, I personally think that this framework is used with caution in actual projects.

The following is a brief description of the EF.

In. NET Framework SP1, Microsoft contains an Entity Framework, which can be understood as An ORM product of Microsoft. It is used to allow developers to create data access applications by programming the conceptual application model (instead of directly programming the relational storage Architecture. The goal is to reduce the amount of code required by data-oriented applications and reduce maintenance work. Entity Framework applications have the following advantages:

· Applications can work through a more application-centric conceptual model (including types with inheritance, complex members, and relationships.

· Applications no longer have hard coding dependencies on specific data engines or storage architectures.

· You can change the ing between a conceptual model and a storage-specific architecture without changing the application code.

· Developers can use application object models that can be mapped to various storage architectures (which may be implemented in different database management systems.

· Multiple conceptual models can be mapped to the same storage architecture.

· Language integration query supports compiling syntax verification for conceptual models.

The Entity Framework is a set of technologies in ADO. Net that support developing data-oriented software applications. The Entity Data Model (EDM) in EF is defined by the following three models and ing files with corresponding file extensions.

· Conceptual Architecture Definition Language file (. CSDL)-define conceptual models.

· Storage Architecture Definition Language file (. SSDL)-defines the storage model (also known as the logical model ).

· Ing specification language file (. MSL)-defines the ing between the storage model and the conceptual model.

The Entity Framework uses these XML-based models and ing files to convert the creation, read, update, and delete operations on entities and relationships in the conceptual model to the equivalent operations in the data source. EDM even supports ing entities in the conceptual model to stored procedures in the data source. It provides the following methods for querying EDM and returning objects:

· LINQ to entities-provides integrated language query (LINQ) to query object types defined in the conceptual model.

· Entity SQL-SQL dialect unrelated to storage, which directly uses entities in the conceptual model and supports EDM functions such as inheritance and relationship.

· Query Builder method-you can use the query method of the LINQ style to construct an Entity SQL query.

Demonstrate the physical framework architecture used to access data:

 

The following describes how to use EF. Software environment ::

· Visual Studio 2008 + SP1

· SQL server2005/2008

First, create a solution named "efproject" and add a class library project named "efmodel. As shown in.

Add the "ADO. NET Entity Data Model" project to the efmodel project, as shown in:

Set the name to "northwindef. edmx" and click "add ". Then, in the subsequent step, after selecting "northwind" for the database, select all the tables, attempts, and stored procedures as the shadow object, and save the default values for all other objects. Shows the final result.

Now, the data model is generated.

Finally, let's talk about some shortcomings I think:

· Edmx contains the CSDL, SSDL, and MSL files of all objects, which is too large. If you want to manually modify this file, if you are not careful about it, you will be able to correct it. (Same as Datasets ).

· Currently, EF supports tables, attempts, and stored procedures. Other objects are not supported, and there are many restrictions on using stored procedures (currently, efextension provides more support for objects ).

· In addition to the visual design interface that ms SQL Server can provide, other databases do not yet provide a visual design interface (but you can implement it yourself, which will be described later ).

· Performance problems. (I can see more information on the Internet than ADO. net is 700 slow, and some people say it is faster than ado.net. I haven't tested it yet, but I think the performance of some types of frameworks is definitely slower than the original ecology of ado.net)

Now, let's take a look at the following simple operations.

Entity Framework learning basics 1--ef overview Guide

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.