Entity Framework-Entities Framework Basics

Source: Internet
Author: User

Before writing the data Layer D layer when there are many SQL statements, how to omit the tedious SQL statements, Microsoft provides a good way-Entity Framework-entity framwork. An object mapping mechanism that supports. NET developers use domain-specific objects to come out of relational data, eliminating the need for most of the data access code that developers typically need to write.

     ADO.NET Entity Framework  is Microsoft   ado.net  as a basis for the development of the object relationship corresponding to   (O/R  mapping)   Solutions. The Entity Framework is a set of technologies in ADO that support the development of data-oriented software applications. is an ORM framework for Microsoft.

What is an ORM framework? The generalized refers to the object-oriented object model and the relational model database of the data structure of the mutual transformation. In narrow sense, it can be considered that data storage based on relational database realizes a virtual object-oriented data access interface. Ideally, based on such an object-oriented interface, persisting an Oo object should not need to know the implementation details of any relational database storage data. such as: O (object model)-m (mapping relationship)-R (relational model).


Find out about the different ways you can use the Entity Framework for access a relational database from    Your. NET application.


Three ways to implement the Entity Framework: Modelfirst, Dbfirst, Codefirst.

Modelfirst generates SQL scripts from existing entity Class diagram transformations and establishes a database. Dbfirst maps an entity class of an object based on an existing database. Codefirst generates SQL scripts based on the code of an existing entity class, establishes a database, and supports cross-database. The concrete construction process does not repeat.

Controversial EF pros and cons:

Paste One:

What are the advantages of changing the use of entityframework in an existing system?

      ? The All-in-1-class mapping table of the framework requires the mapping code to be written and is difficult to maintain.

? Maintainable, easy-to-understand code without the need to create a large data access layer.
? Provides a LINQ query database, which requires less understanding of SQL from the novice developer.
? EF can be used as an infrastructure for data services and OData service.

What is the case that does not suggest using EF ?

? Real-time application.
? The database can only be accessed through stored procedures. The advantage of EF is that it is not only on stored procedures when tracking entity state change. (even though EF does have limited support for stored procedures).
? Frequent insert operations (insert), and EF does not support large data bulk inserts.
frequent update operation, the target of the update is mainly when MultiRow (with a single value)
For example: UPDATE table name SET Columa = ten Where columnb =?
This update operation is better used by ExecuteNonQuery (also available from context contexts or directly from ADO).
? Anti-paradigm table design and high-performance queries. EF generates queries that are difficult to maintain and do not support mapping to non-canonical tables well.

? There are very performance requirements for the program, and each query needs to be monitored.

Excerpt from: http://www.cnblogs.com/wintersun/archive/2013/03/16/2963992.html

Post two:

The Entity Framework is an ORM framework provided by m$, which is designed to facilitate the rapid development of data tiers in small applications.

More than 185W download volume on NuGet, description. NET developers prefer to use EF. But EF has a lot of drawbacks in providing convenience, and here are the scenarios I don't think I should apply EF:

    • Non-SQL Server database with no dataprovider for this database
    • High performance requirements. In the case of complex queries, EF does not perform well, and developers cannot control the generation of SQL statements
    • High security requirements. Sometimes DB users just have EXEC permissions, and EF automatically generates classes that don't work, or you need to write them yourself.
PS: Read a lot about its evaluation, frankly speaking, there is inevitablyreject the sound. This is a big step forward in Microsoft's data processing. The small part or the first to accept and in-depth understanding after the definition it. Existence is justified.

Entity Framework-Entities Framework Basics

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.