2
简单的问题 - 其中是实体框架6中的dbContext.CreateQuery方法,如果答案是不存在这样的方法我的问题是怎么做到通过SQL查询获取一些数据到一个objectQuery?Entity Framework中的CreateQuery在哪里6
简单的问题 - 其中是实体框架6中的dbContext.CreateQuery方法,如果答案是不存在这样的方法我的问题是怎么做到通过SQL查询获取一些数据到一个objectQuery?Entity Framework中的CreateQuery在哪里6
演员上下文IObjectContextAdapter
和使用ObjectContext
,例如:
using (var context = new AdventureEntities())
{
string eSql = "SELECT VALUE c FROM AdventureEntities.Customer AS c ORDER BY c.LastName";
var query = ((IObjectContextAdapter)context).ObjectContext.CreateQuery<Customer>(eSql);
var customers = query.ToList();
foreach (Customer customer in customers)
{
Console.WriteLine("{0}, {1}", customer.FirstName, customer.LastName);
}
}
退房这个帖子:http://stackoverflow.com/questions/14506161/cant-find-createquery-method – Laszlo