Entity Framework 4.1 DbContext对T-SQL的支持
摘要:
一、查询实体类 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"); 阅读全文
posted @ 2011-07-14 15:32 Ant 阅读(459) 评论(0) 推荐(0) 编辑