1、无需先查询数据的修改方法
// 将创建的data实体添加到ObjectContext db.Data.Attach(data); // 手动设置状态为修改 db.ObjectStateManager.ChangeObjectState(data, EntityState.Modified); db.SaveChanges();
2、嵌套Action(页面)
@Html.Action("left","system") // 目录为system/left/ 的action
3、ef查询一行一列信息
var singleResult = db.ExecuteStoreQuery<string>("select count(*) as counts from userinfo"); foreach (var item in singleResult) { // 只有一条信息 string result = item; }