Entity States
Added. The entity does not yet exist in the database. The SaveChanges method must issue an INSERT statement.
Unchanged. Nothing needs to be done with this entity by the SaveChanges method. When you read an entity from the database, the entity starts out with this status.
Modified. Some or all of the entity's property values have been modified. The SaveChanges method must issue an UPDATE statement.
Deleted. The entity has been marked for deletion. The SaveChanges method must issue a DELETE statement.
Detached. The entity isn't being tracked by the database context.(分离状态:实体没有被数据上下文跟踪)
Entity states让SaveChanges()方法可以确定命令内容
For example, when you pass a new entity to the Add method, that entity's state is set to Added. Then when you call the SaveChanges method, the database context issues a SQL INSERT command.
Entity States的更多相关文章
- EF4.1: Add/Attach and Entity States(EF中的实体状态转换说明)
实体的状态,连接以及 SaveChanges 方法 数据库上下文对象维护内存中的对象与数据库中数据行之间的同步.这些信息在调用 SaveChanges方法被调用的时候使用.例如,当使用 Add 方法传 ...
- 实体生命周期【Entity Lifecycle】(EF基础系列10)
Before we work on CRUD operation (Create, Read, Update, Delete), it's important to understand the en ...
- ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第六章:管理产品图片——多对多关系(上篇)
在这章中,我们将学习如何创建一个管理图片的新实体,如何使用HTML表单上传图片文件,并使用多对多关系将它们和产品关联起来,如何将图片存储在文件系统中.在这章中,我们还会学习更加复杂的异常处理,如何向模 ...
- Entity Framework Code First - Change Tracking
In this post we will be discussing about change tracking feature of Entity Framework Code First. Cha ...
- Entity Framework Tutorial Basics(10):Entity Lifecycle
Entity Lifecycle: Before we work on CRUD operation (Create, Read, Update, Delete), it's important to ...
- Entity Framework Tutorial Basics(7):DBContext
DBContext: As you have seen in the previous Create Entity Data Model section, EDM generates the Scho ...
- 数据上下文【 DnContext】【EF基础系列7】
DBContext: As you have seen in the previous Create Entity Data Model section, EDM generates the Scho ...
- 【记录】EF Code First 实体关联,如何添加、修改实体?
在使用 EF Code First 的时候,我们经常会对项目中的 Entry 进行一对多.多对多的映射配置,这时候就会产生主实体和子实体的概念,我们在添加.修改他们的时候,有时候会产生一些问题,比如添 ...
- [渣译文] 使用 MVC 5 的 EF6 Code First 入门 系列:实现基本的CRUD功能
英文渣水平,大伙凑合着看吧…… 这是微软官方SignalR 2.0教程Getting Started with Entity Framework 6 Code First using MVC 5 系列 ...
随机推荐
- 在 Java 中如何进行 BASE64 编码和解码
BASE64 编码是一种常用的字符编码,在很多地方都会用到.JDK 中提供了非常方便的 BASE64Encoder 和 BASE64Decoder,用它们可以非常方便的完成基于 BASE64 的编码和 ...
- C++实现简单的内存块自己主动管理
#ifndef __MEM__H #define __MEM__H #include<iostream> using namespace std; //自己主动管理内存块 typedef ...
- 【codeforces 760B】Frodo and pillows
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- Guava中TreeRangeMap基本使用
RangeMap跟一般的Map一样.存储键值对,依照键来取值.不同于Map的是键的类型必须是Range,也既是一个区间.RangeMap在Guava中的定义是一个接口: public interfac ...
- Windows下启动ActiveMq端口被占用的解决办法
cd /D E:\RuntimeSoft\apache-activemq-5.11.0\binactivemq.bat start结果提示:端口号被占用. Windows下查看端口号被占用开始--运行 ...
- Bootstrap3简单好用,轻松实现手机适配
个人官网http://FansUnion.cn,前端使用Bootstrap框架.大部分的样式,轻松就实现了. 只是呢,关于导航条,被无数网友吐槽了. 通过手机访问时,导航条把屏幕给完全占居了 ...
- [转]Redis 与Mysql通信
http://blog.csdn.net/hpb21/article/details/7852934 找了点资料看了下.学习心得如下: 1 Mysql更新Redis Mysql更新Redis借鉴mem ...
- 【a901】滑雪
Time Limit: 10 second Memory Limit: 2 MB 问题描述 滑雪是一项非常刺激的运动,为了获得速度,滑雪的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待 ...
- 【u220】生日礼物
Time Limit: 1 second Memory Limit: 128 MB [问题描述] 一对双胞胎兄妹同一天过生日,这一天,他们的朋友给他俩送来了礼物,每个人送的礼物都是2本书,一本给哥哥, ...
- ios 即时通讯开源IM,LeanCloud、融云、环信
环信官网链接: http://easemob.com/docs/ios/