First article: Introduction to the Entity Framework

Source: Internet
Author: User
Tags microsoft download center

Let's start with Orm, many years ago, because. NET's open source component is not as well developed as it is now, let alone an open source ORM framework, for project needs, and when OOP arose (not always, in a project full of SQL statements), began to write the ORM framework. To develop an ORM framework, first understand the ORM concept.

ORM Object Relational mappings, O (object) objects, are entities in a project, more precisely the data model, or persistent classes. R (Relation) relational data , M (Mapping) mapping, the process of mapping an object to relational data, and mapping relational data to an object.

More intuitive to understand is that ORM is the idea of OOP, generating additions and deletions to change SQL statements

After understanding the ORM concept, you will find that in fact the ORM framework, the main difficulty in the M-Map section

O create a simple entity object to

Data table in R relational database

M difficulty how to associate a physical object with a relational database specific data table and then generate the corresponding database operation SQL?

At the time, fortunately, the two technologies of. NET are more popular

1. Features

2. Reflection

At that time, the main use of characteristics to identify the entity mapping specific database TableName, attributes corresponding to the specific table ColumnName, as well as the main external, whether self-increment, the default value and so on, are identified by the characteristics.

The corresponding SQL statement can be generated by reflecting the attributes on the entity, and then changing the operation method according to the additions and deletions.

At this point a simple ORM framework is available.

In recent years,. NET technology has developed rapidly, with many well-written open source components springing up, including the ORM framework

Hibernate, Drapper,entityframework, etc.

EntityFramework Version History Introduction

EF version . NET Framework and IDE versions Key Features
EF (or EF3.5) Visual Studio SP1 (. NET 3.5 SP1) Basic O/R mapping support, using DB first development mode
ef 4 visual Studio (. NET 4.0)
delay loading  
improve unit test capability  
custom code generation mechanism  
support model first development mode
EF 4.1 NuGet Provides a simplified DbContext interface
Support for code First development mode
EF 4.1.1 Transition version Support for power tools tools
EF 4.2 Transition version Fix bugs and optimize
EF 4.3 Visual Studio (. NET 4.0) Code first development mode-based migration strategy migrations
ef 4.3.1
EF 5 Visual Studio (. NET 4.5) Provides support for enumeration types
table-valued functions Table-valued functions
Spatial data type (spatial types)
Overall performance optimization improvement
Entity Model Designer, multi-graph model
Bulk import of stored procedures
EF 6 Visual Studio (. NET 4.5) Power Tools Strengthens
EF released separately from Visual Studio and. NET through NuGet
Configurable number of retries for unstable connections, etc.
support for task-based asynchronous programming patterns in. NET 4.5 async Query and Save
optimized configuration options code-based Config
support for Dependency injection and service positioning Dependency Resolution
Low-level EF interceptor and SQL log interception/sql Loggin
using mock unit tests
using a mocking framework or writing your own test doubles
create DbContext with existing DbConnection
improved Transaction support for enhanced transactions
optimizing LINQ to Entities query performance
optimization (View Generation) Performance
support for customizing the Equals and GetHashCode methods for implementing entity
Dbset.addrange/removerange
dbchangetracker.haschanges
Extended Sqlfunctions,sqlcefunctions
EF 6.0.1 Visual Studio (. NET 4.5) Fix some performance issues during warm-up for EF models.
EF 6.0.2 Visual Studio (. NET 4.5) The tooling for Visual Studio and Visual Studio
Available on the Microsoft Download Center. Need to
Install the tooling if want to use Model first or Database first
EF 6.1 Visual Studio (. NET 4.5)

Tooling Consolidation provides a consistent to create a new EF model. This feature extends the ADO Entity Data Model Wizard to support creating Code first models, including reverse Enginee Ring from an existing database. These features were previously available in Beta quality in the EF Power Tools.

handling of transaction commit failures provides thecommitfailurehandler which makes use of the newly introduced Ability to intercept transaction operations. The Commitfailurehandler allows automatic recovery from connection failures whilst committing a transaction

Indexattributeallows indexes to being specified by placing an [Index] attribute on a property (or properties) in R Code First model. Code first would then create a corresponding index in the database

The public mapping API provides access to the information EF have on how properties and types is mapped to column s and tables in the database. In past releases the This API is internal

EntityFramework just came out, the response is quite good. At that time I had contact some, not many, also did not know why then so good thing, did not dig a bit.

2014, went to a start-up company, as a technical director, to do architecture development, then set the ASP. NET MVC 5&entity Framework 6 as a development framework.

Once again understand the power of entityframework.

There are three ways to implement the Entity Framework

1. Database First

2. Model First Models

3. Code First

The first two are drag controls, and follow the instructions to complete the entity Framework implementation.

Code first is purely hand-crafted.

An introduction to the Entity Framework is now complete, and this series of implementation Entity Framework is code first because code first knows more about how the Entity Framework works.

This series is based on the Entity Framework version 6.1, which is not very different in the last few versions.

codeplex:http://entityframework.codeplex.com/

github:https://github.com/aspnet/entityframework/

Development Guide: https://docs.efproject.net/en/latest/

Please expect

Article two: Entity Framework Codefirst & Model Mappings

First article: Introduction to 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.