zoukankan      html  css  js  c++  java
  • 跪求 EF缓存问题 也不知道是不是缓存 问题

    1.数据库里面查的结果  

    2 vs里面查的结果   为什么 不是16 而是2   

    下面是代码 

    /// <summary>
    /// 权限检查
    /// </summary>
    public class checkPermission : AuthorizeAttribute
    {
    AliexpressEntities aliexpressEntities = new AliexpressEntities();
    public override void OnAuthorization(AuthorizationContext filterContext)
    {
    HttpContextBase context = filterContext.HttpContext;
    var url = "/login";

    if (context.Session["user"] == null)
    {
    context.Response.Write(string.Format("<script> window.top.location.href='{0}';</script>", url));
    }
    else
    {
    var user = context.Session["user"] as YH_User;
    string Controller = null;
    string action = null;
    if ( filterContext.ParentActionViewContext!=null) //部分试图
    {
    action= filterContext.ParentActionViewContext.RouteData.Values["action"].ToString().ToLower();
    Controller = filterContext.ParentActionViewContext.RouteData.Values["controller"].ToString().ToLower();

    }
    else
    {
    Controller = (filterContext.ActionDescriptor).ControllerDescriptor.ControllerName.ToLower();
    action = filterContext.ActionDescriptor.ActionName.ToLower();
    }

    var role = aliexpressEntities.SYS_User_Role.Where(p => p.isActive == true && p.UserId == user.userId).Single();

    //这里获取不到最新的数据


    //所属角色下所有的权限
    var IsSystemModel = aliexpressEntities.SYS_SystemModel.Where(p => p.isActive == true && aliexpressEntities.SYS_Role_Permissions.Where(M => M.isActive == true && M.RoleId == role.RoleId).Select(M => M.SystemModelId).Contains(p.SystemModelId) && p.Controllers.ToLower() == Controller && p.Action.ToLower() == action).FirstOrDefault();
    if (IsSystemModel==null)
    {
    context.Response.Write(string.Format("<script> window.top.location.href='{0}';</script>", url));
    }

    }

    }
    }

    求大神解答  

  • 相关阅读:
    Webbrowser中模拟连接点击(非鼠标模拟)
    用DDE控制Word
    禁止用键盘左右箭头,去切换PageControl页签
    Delphi实现全局鼠标钩子
    Delphi实现软件中登录用户的操作权限
    根据数据库结构生成TreeView
    根据字符串找到函数并执行
    用DLL实现插件的简单演示
    Delphi:窗体的扩展样式GWL_EXSTYLE用于SetWindowLong
    FastReport问题整理(http://129.sqdj.gov.cn/?p=77)
  • 原文地址:https://www.cnblogs.com/520cc/p/4133819.html
Copyright © 2011-2022 走看看