程序代码如下,开发环境为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方法
}
Console.ReadKey();
}
}
}
求解,谢谢!
------解决方案--------------------
using System.Data.Entity;