Entity Framework 4.1 DbContext对TSQL的支持

一、查询实体类

  ctx.Users.SqlQuery("select * from dbo.Users").ToList();

 二、查询单个字段

  ctx.Database.SqlQuery<string>("select Name from dbo.Users").ToList();

三、使用T-SQL更新数据

  ctx.Database.ExecuteSqlCommand( "update dbo.Users set Age=20 where UserId=100");

原文地址:https://www.cnblogs.com/wiseant/p/2106427.html