> For the complete documentation index, see [llms.txt](https://jen-hsuan-hsieh.gitbook.io/asp-net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jen-hsuan-hsieh.gitbook.io/asp-net/chapter1/1.1.the-complete-asp.net-mvc-5-course/13working-with-data/131entity-framework.md).

# 1.3.1.Entity framework

## 1. Introduction

* We do not need to map manually which involve opening connection to database, executing command reading the data and finally remember to close connection with an object relation mapper

  ![](https://163116165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4M0G7tIs4o9F9vSrao%2F-M4M0IVB0ax0vs2ocz_r%2F-M4M0OsfAnQpfXa87g_n%2F%E6%9C%AA%E5%91%BD%E5%90%8D.jpg?generation=1586302962539110\&alt=media)

## 2. How Entity framework works

* DbContext: gateway to database, has one or more DBSets
* DbSet: present tables in database

  ![](https://163116165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4M0G7tIs4o9F9vSrao%2F-M4M0IVB0ax0vs2ocz_r%2F-M4M0OshEtYgOOysTUXi%2F%E6%9C%AA%E5%91%BD%E5%90%8D4.jpg?generation=1586302962297577\&alt=media)

## 3. Manipulations

* LINQ

  ![](https://163116165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4M0G7tIs4o9F9vSrao%2F-M4M0IVB0ax0vs2ocz_r%2F-M4M0OsjLTm1KVrn0XxA%2F%E6%9C%AA%E5%91%BD%E5%90%8D3.jpg?generation=1586302962747874\&alt=media)
