Ef和ado.net 数据问题

列表页面我用的是ef查询出来
public ActionResult Index(FormCollection collection, int id = 1)
{
BLLOperateContext bll = new BLLOperateContext();
int count;
int totlePageCount;
IList list = bll.BLLSession.It_AdminBLL.GetPagedList(ref id, 10, o => true, o => o.id, out count, out totlePageCount).ToList();
List dlist = list.Select(o => new AdminLoginModel
{
Id = o.id,
RealName = o.f_realName,
LoginName = o.f_loginName,
ReLoginPass = o.f_loginPass,
LoginPass = o.f_loginPass
}).ToPagedList(id, 10, count);
return View(dlist);
}
编辑页面我用的ado.net
[HttpPost]
public ActionResult Edit(AdminLoginModel model)
{
string valId = Request.Form["isValue"];
ViewBag.Temp = valId;
//BLLOperateContext bll = new BLLOperateContext();

        //EFModel.t_Admin admin = bll.BLLSession.It_AdminBLL.GetListBy(o => o.id == model.Id).FirstOrDefault();

        //admin.f_loginName = model.LoginName;
        //admin.f_loginPass = model.LoginPass;
        //admin.f_realName = model.RealName;
        //bll.BLLSession.It_AdminBLL.Modify(admin);
        //TempData["Msg"] = "修改成功";
        //return RedirectToAction("Index");
        if (valId == model.LoginName || CheckAdminExists(model))
        {
            if (AdminBLL.UpdateAdmin(model))
            {
                TempData["Msg"] = "修改成功";
                return RedirectToAction("Index");
            }
            else
            {
                TempData["Msg"] = "修改失败";
                return View();
            }
        }
        else
        {
            TempData["Msg"] = "用户名已存在";
            return View();
        }
    }
            为什么 我修改数据后 返回的列表页面数据还是旧的数据 数据库监控ef执行的sql也是对的 list集合却是不对的?两种架构 EF+3层接口+spring.net 和简单三层
net

2个回答

没看到你用ado.net
BLLOperateContext是EF的DataContext么,调用下Refreash看看。

问题我解决了 因为缓存的问题

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问