实体框架4:我的load方法和IsLoaded属性在哪里? [英] entity framework 4: where is my load method and IsLoaded property?

查看:99
本文介绍了实体框架4:我的load方法和IsLoaded属性在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是EF4,我在我的课上使用System.Data.Entity dll。但是,我看不到我的实体的导航属性的加载方式。



如何访问此方法?



我正在做的是创建.NET 4.0的项目,从数据库创建我的edmx,右键单击模型edmx,并生成一个DBContext。



但是,我可以访问我的上下文的本地属性,我认为这是EF4的一个功能。



谢谢。
Daimroc。

解决方案

对于 DbContext IsLoaded 属性和加载方法已被移动:

  context.Entry(yourEntity)
.Collection(entity => entity.NavigationProperty)
.IsLoaded;

context.Entry(yourEntity)
.Collection(entity => entity.NavigationProperty)
.Load();




I am using EF4, and I using the System.Data.Entity dll in my class. However, I can't see the load method of my navigation property of my entity.

How can I access to this method?

What I am doing is create e 4.0 project of .NET, create my edmx from a database, right click in the model edmx and I generate a DBContext.

However, I can access to the local property of my context, that I think that is a feature of EF4.

Thanks. Daimroc.

解决方案

For the DbContext approach, the IsLoaded property and Load method have been moved:

context.Entry(yourEntity)
   .Collection(entity => entity.NavigationProperty)
   .IsLoaded;

context.Entry(yourEntity)
   .Collection(entity => entity.NavigationProperty)
   .Load();

这篇关于实体框架4:我的load方法和IsLoaded属性在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆