Entity Framework Tutorial Basics(20):Persistence in Entity Framework
Persistence in Entity Framework
There are two scenarios when persisting an entity using EntityFramework, connected and disconnected scenarios.
Connected Scenario: This is when an entity is retrieved from the database and persist is used in the same context. Context object doesn't destroy between entity retrieval and persistence of entities.
Disconnected Scenario: Disconnected scenario is when an entity is retrieved from the database and the changed entities are submitted using the different objects in the context. The following example illustrates disconnected scenario:
As per the above scenario, Context1 is used for read operation and then Context1 is destroyed. Once entities change, the application submits entities using Context2 - a different context object.
Disconnected scenario is complex because the new context doesn't know anything about the modified entity so you will have to instruct the context of what has changed in the entity. In the figure below, the application retrieves an entity graph using Context 1 and then the application performs some CUD (Create, Update, Delete) operations on it and finally, it saves the entity graph using Context 2. Context 2 doesn't know what operation has been performed on the entity graph in this scenario.
Learn how to do the CRUD operation in the connected scenario in the next section.
Entity Framework Tutorial Basics(20):Persistence in Entity Framework的更多相关文章
- Entity Framework Tutorial Basics(8):Types of Entity in Entity Framework
Types of Entity in Entity Framework: We created EDM for existing database in the previous section. A ...
- Entity Framework Tutorial Basics(2):What is Entity Framework?
What is Entity Framework? Writing and managing ADO.Net code for data access is a tedious and monoton ...
- Entity Framework Tutorial Basics(25):Delete Single Entity
Delete Entity using DBContext in Disconnected Scenario: We used the Entry() method of DbContext to m ...
- Entity Framework Tutorial Basics(24):Update Single Entity
Update Existing Entity using DBContext in Disconnected Scenario: In this chapter, you will learn how ...
- Entity Framework Tutorial Basics(23):Add Single Entity
Add New Entity using DBContext in Disconnected Scenario: In this chapter you will learn how to add n ...
- Entity Framework Tutorial Basics(1):Introduction
以下系列文章为Entity Framework Turial Basics系列 http://www.entityframeworktutorial.net/EntityFramework5/enti ...
- Entity Framework Tutorial Basics(31):Migration from EF 4.X
Migration from Entity Framework 4.1/4.3 to Entity Framework 5.0/6.0 To migrate your existing Entity ...
- Entity Framework Tutorial Basics(27):Update Entity Graph
Update Entity Graph using DbContext: Updating an entity graph in disconnected scenario is a complex ...
- Entity Framework Tutorial Basics(22):Disconnected Entities
Disconnected Entities: Before we see how to perform CRUD operation on disconnected entity graph, let ...
随机推荐
- 如何去除Linux文件的^M字符
Windows上写好的文件,在Linux或者Unix下打开,每一行都会出多出^M这样的字符,这是因为Windows与*nix的换行符不同所致,我们看看文件格式有什么不同.*注:“^M”,需要使用Ctr ...
- bgcolor RGB 和16进制之间的转换,16进制转RGB,源码
<p>bgcolor RGB 和16进制之间的转换,16进制转RGB,源码例如:<br /> 输入 201,255,201 转换成 #C9FFC9</p> < ...
- SaaS模式实现架构
SaaS模式实现架构 https://blog.csdn.net/xwq911/article/details/50630266 1. 数据库层: 数据库这一层的设计模式是很清晰的,无外乎只有3种方案 ...
- 用HAWQ轻松取代传统数据仓库(八) —— 大表分区
一.HAWQ中的分区表 与大多数关系数据库一样,HAWQ也支持分区表.这里所说的分区表是指HAWQ的内部分区表,外部分区表在后面“外部数据”篇讨论.在数据仓库应用中,事 实表通常有非常多 ...
- 简洁的Jquery弹出窗插件
做项目时,很多时候都需要弹窗提示.如果要求不是很严格的项目,直接使用alert就可以搞定.对于需要高度定制化的项目,而且要求比较高的时候,就需要设计符合整体风格的弹出层,这种有美工帮忙,也比较好搞定. ...
- bzoj 4589 Hard Nim——FWT
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4589 一开始异或和为0的话先手必败.有 n 堆,每堆可以填那些数,求最后异或和为0的方案数, ...
- DataX实现oracle到oracle之间的数据传递
首先需要注意的是DATAX是通过JDBC的方式读取ORACLE数据,然后通过OCI的方式写数据,DX也可以通过JDBC写的方式进行,但是OCI比JDBC速度更快. 进入DataX安装目录的bin目 ...
- Eclipse中的普通Java项目如何部署到Tomcat中
我现在的做法: 1.在Eclipse中配置Tomcat时,选择创建Context文件,而不是server.xml,好处是文件可以随便命名,与虚拟目录一致(即xml中的属性path).Tomcat加载项 ...
- mybatis 动态sql语句(1)
mybatis 的动态sql语句是基于OGNL表达式的.可以方便的在 sql 语句中实现某些逻辑. 总体说来mybatis 动态SQL 语句主要有以下几类: 1. if 语句 (简单的条件判断) 2. ...
- Celery-4.1 用户指南: Extensions and Bootsteps (扩展和Bootsteps)
自定义消息消费者 你可能想要嵌入自定义的 Kombu 消费者来手动处理你的消息. 为了达到这个目的,celery 提供了一个 ConsumerStep bootstep 类,你只需要定义 get_co ...