Entity Framework
fcc_ecjtu
喜欢交朋友!
展开
-
EF Update Entity
public void Update(Entity obj){using (MyContext db = new MyContext(connectionString)) { db.MyDbSet.Attac原创 2011-09-16 20:43:18 · 3653 阅读 · 0 评论 -
为导航属性关闭延迟加载
延迟加载是在第一次调用导航属性时从数据库加载得,延迟加载是通过代理类和虚属性实现的.public class Princess { public int Id { get; set; } public string Name { get; set;翻译 2011-09-18 15:39:17 · 576 阅读 · 0 评论 -
Code First/Entity Framework 4.1 Videos and Articles on MSDN
Currently, 8 of the 10 videos on Code First and EF 4.1 I have already created for MSDN are online but they are not easy to find.Three of t转载 2011-09-18 09:03:26 · 7263 阅读 · 0 评论 -
显式加载关联实体
通过Load方法显式加载关联实体using (var context = new UnicornsContext()){ var unicorn = context.Unicorns.Find(1); var princess = context.Pr原创 2011-09-18 15:43:34 · 392 阅读 · 0 评论 -
同时加载多级关联实体
using (var context = new UnicornsContext()){ // Load all castles, all related ladies-in-waiting, and all related // princesses原创 2011-09-18 15:28:06 · 469 阅读 · 0 评论 -
同步加载关系实体
Eager loading is the process whereby a query for one type of entity also loads related entities as part of the query. Eager loading is ach原创 2011-09-18 15:21:25 · 377 阅读 · 0 评论 -
禁用自动检测实体更改
using(varcontext = newUnicornsContext()){ try { context.Configuration.AutoDetectChangesEnabled = false;原创 2011-09-18 14:54:11 · 491 阅读 · 0 评论 -
不加载关联实体的前提下获得关联实体数
using (var context = new UnicornsContext()){ var princess = context.Princesses.Find(1); // Count how many unicorns the princess owns原创 2011-09-18 15:52:32 · 476 阅读 · 0 评论 -
Entity Framework Repository & Unit Of Work T4 Template on CodePlex
I have a posted a project on Codeplex at http://efrepository.codeplex.com. It is a T4 template to give you a data layer that follows Repo转载 2011-09-16 21:47:54 · 870 阅读 · 0 评论 -
Implementing Repository Pattern With Entity Framework
The Repository pattern is defined by Patterns of Enterprise Application Architecture as: Mediates between the domain and data mapping la转载 2011-09-16 21:31:40 · 877 阅读 · 0 评论 -
为所有实体关闭延迟加载
public class UnicornsContext : DbContext{ public UnicornsContext() { this.Configuration.LazyLoadingEnabled = false;原创 2011-09-18 15:41:17 · 571 阅读 · 0 评论