跪求 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));
}
}
}
}
求大神解答
跪求 EF缓存问题 也不知道是不是缓存 问题的更多相关文章
- MVC缓存02,使用数据层缓存,添加或修改时让缓存失效
在"MVC缓存01,使用控制器缓存或数据层缓存"中,在数据层中可以设置缓存的有效时间.但这个还不够"智能",常常希望在编辑或创建的时候使缓存失效,加载新的数据. ...
- Mybatis缓存(1)--------系统缓存及简单配置介绍
前言 Mybatis的缓存主要有两种: 系统缓存,也就是我们一级缓存与二级缓存: 自定义的缓存,比如Redis.Enhance等,需要额外的单独配置与实现,具体日后主要学习介绍. 在这里主要记录系统缓 ...
- spring整合ehcache 注解实现查询缓存,并实现实时缓存更新或删除
写在前面:上一篇博客写了spring cache和ehcache的基本介绍,个人建议先把这些最基本的知识了解了才能对今天主题有所感触.不多说了,开干! 注:引入jar <!-- 引入ehcach ...
- 2.spring整合ehcache 注解实现查询缓存,并实现实时缓存更新或删除
转自:http://www.importnew.com/23358.html 写在前面:上一篇博客写了spring cache和ehcache的基本介绍,个人建议先把这些最基本的知识了解了才能对今天主 ...
- C# - 缓存OutputCache(二)缓存详细介绍
本文是通过网上&个人总结的 1.缓存介绍 缓存是为了提高访问速度,而做的技术. 缓存主要有以下几类:1)客户端缓存Client Caching 2)代理缓存Proxy Caching 3)方向 ...
- Spring自定义缓存管理及配置Ehcache缓存
spring自带缓存.自建缓存管理器等都可解决项目部分性能问题.结合Ehcache后性能更优,使用也比较简单. 在进行Ehcache学习之前,最好对Spring自带的缓存管理有一个总体的认识. 这篇文 ...
- [转]MVC3缓存之一:使用页面缓存
本文转自:http://www.cnblogs.com/parry/archive/2011/03/19/OutputCache_In_MVC3.html 在以前的WebForm的开发中,在页面的头部 ...
- 使用Retrofit和Okhttp实现网络缓存。无网读缓存,有网根据过期时间重新请求 (转)
使用Retrofit和Okhttp实现网络缓存,更新于2016.02.02原文链接:http://www.jianshu.com/p/9c3b4ea108a7 本文使用 Retrofit2.0.0-b ...
- MVC3缓存之一:使用页面缓存
MVC3缓存之一:使用页面缓存 在MVC3中要如果要启用页面缓存,在页面对应的Action前面加上一个OutputCache属性即可. 我们建一个Demo来测试一下,在此Demo中,在View的Hom ...
随机推荐
- 转载:常见EXE文件反编译工具
PE Explorer V1.99 R5 绿色汉化特别版_强大的可视化汉化集成工具 功能极为强大的可视化汉化集成工具,可直接浏览.修改软件资源,包括菜单.对话框.字符串表等: 另外,还具备有 W32D ...
- 使用PULL方式解析XML资源文件下面的xml文件
public class MainActivity extends Activity { private Button btn = null; private List<Map<Strin ...
- cf A. Jeff and Digits
http://codeforces.com/contest/352/problem/A #include <cstdio> #include <cstring> #includ ...
- Windows下连接php5.3+sql server2008
php连接sql server真是一件闹心的事, 折腾了许久,今天有了点起色,还是不错的. mssql extension is not available anymore on Windows wi ...
- UML--核心元素之参与者Actor
参与者(actor):在系统之外与系统交互的某人或某事物.例如,管理员,用户等等. 参与者位于边界之外,边界之内的都不叫参与者.用一个词来形容更准确,主角.也就是只有主动启动了这个业务的人,才是参与者 ...
- DragonBoard810使用记录
1. 执行~/workdir/Source_Package$ getSource_and_build.sh后该脚本先下载android仓库.repo到~目录,然后将android源码check out ...
- Quartus DSE 初步应用
介绍 Design Space Explorer (DSE) is a program that automates the process of finding the optimal collec ...
- C5-信号量与PV操作(iOS篇-细说信号量)
一.概述 信号量这种同步机制的概念. P, V操作(Dijkstra提出)的定义 github地址(iOS中的信号量是以1开始定义): https://github.com/sixleaves/sem ...
- 【HDU2120】Ice_cream's world I(并查集基础题)
查环操作,裸题.一次AC. #include <iostream> #include <cstring> #include <cstdlib> #include & ...
- OS error set
Failed to resolve/decode supposed IPv4 source addres Failed to resolve/decode supposed IPv4 source a ...