跪求 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));
}
}
}
}
求大神解答
最新文章
- 在php中使用strace、gdb、tcpdump调试工具
- margin:0 auto 与 text-align:center
- SSE and Websocket
- sharepoint2010问卷调查(2)-实现问卷的图片调查(采用自定义字段类型)
- Jenkins遇到问题三:调整jdk版本不生效的解决办法
- Ubuntu小点汇总,更新中...
- (spring-第15回【IoC基础篇】)容器事件
- Hashset,Iterator
- LA 5059 (找规律 SG函数) Playing With Stones
- js 自己容易搞混的笔记查询
- 1671: [Usaco2005 Dec]Knights of Ni 骑士
- Java基础——多态
- linux_网站计量单位
- bzoj4487[Jsoi2015]染色问题 容斥+组合
- Java中的String为什么是不可变的? -- String源码分析
- leetcode 890. 查找和替换模式 Python
- springboot shiro开启注释
- ACM-ICPC 2018 沈阳赛区网络预赛 J Ka Chang
- 转载:centos安装redis
- $\mathcal{Friends&#39; \ \ Links}$友情链接
热门文章
- 函数式C代码
- [原创]零基础R语言教程---第二课---R语言入门
- android获取sdk更新
- POJ 2986 A Triangle and a Circle
- (DP)House Robber
- 【LeetCode练习题】Recover Binary Search Tree
- HDU 1576 A/B(数论)
- POJ 3046 Ant Counting DP
- spring3 jsp页面使用<;form:form modelAttribute=";xxxx"; action=";xxxx";>;报错,附连接数据库的spring MVC annotation 案例
- boost格式化输出xml