Lazy Loading 通过LazyLoadingEnabled控制
Eager Loading 通过Include方法实现
而Explicti Loading 通过Load方法实现
具体可以参考
http://www.cnblogs.com/Allen-Li/archive/2012/03/21/2410053.html
但在实际开发过程中却发现无法调用到IsLoaded属性、Load方法
程序代码如下,开发环境为VS2012 .NET + Framework 4.5 + EntityFramework 5.0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ConsoleApplication4.Model;
using System.Diagnostics;
using System.Data.Objects.DataClasses;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
NorthwindEntities db = new NorthwindEntities();
db.Configuration.LazyLoadingEnabled = false;
IQueryable<Employee> employees = from e in db.Employees
select e;
foreach (Employee e in employees)
{
db.LoadProperty(e, e => e.Orders); //编译器提示找不到LoadProperty方法
if (e.IsLoaded) //编译器提示找不到IsLoaded属性
e.Load(); //编译器提示找不到Load方法
}
Console.ReadKey();
}
}
}
求解,谢谢!