我想将它转换为实体框架Lambda Expression,但我没有得到正确的语法......
此SQL查询的实体框架Lambda表达式是什么:
DataTable DT=Select CityName,CityId from City order by cityname;
我想将它存储在Datatable中。那么我怎样才能在MVC中使用Linq Lambda表达式....
答案 0 :(得分:0)
首先将您的上下文实体如下所示
private Entities db = new Entities();
var city = db.cities.select(c => new { c.CityName , c.CityId}).OrderBy(c=> c.CityName);
db.citites.add(city);
db.SaveChanges();
了解更多信息: -
http://onsaurav.blogspot.in/2013/02/beginning-of-entity-framework-with-mvc.html