Security Permissions Caching
Security Permissions Caching
Security permission caching is implemented in Security Adapters - classes used by the Security System to process and cache security permission requests. Each Security Adapter has the corresponding Security Adapter Provider class, which is used internally to register the adapter. XPO adapters and their providers are located in the DevExpress.ExpressApp.Security.Xpo.v17.1.dll assembly. The provider and adapter for the Entity Framework are available in the DevExpress.ExpressApp.Security.EF.v17.1.dll assembly. Both these assemblies (XPO and EF) contain the SecurityAdapterHelper class that exposes static methods that enable/disable Security Adapters. So, in your code, you do not need to access Security Adapters directly. This topic describes how to enable and customize caching using the SecurityAdapterHelper class.
Enable Caching in Code
When creating a new XAF project, caching is enabled by the Solution Wizard. The wizard adds the following code line to the WinApplication.cs (WinApplication.vb) and WebApplication.cs (WebApplication.vb) files.
新建项目时,可以在创向导中选择这个选荐.也可以在代码中修改.(winapplication.cs/webapplication.cs)中:
using DevExpress.ExpressApp.Security;
// ...
SecurityAdapterHelper.Enable();
in the constructor of your platform-agnostic module located in the Module.cs (Module.vb) file;To enable or customize Security permissions caching in an existing application, use the same code, or use another overload of the Enable method that takes an ReloadPermissionStrategy enumeration value. You can call this static method from any place of your code, which is executed before a user is logged on, e.g.:
- in the Main method of the WinForms application located in the Program.cs (Program.vb) file, before the WinApplication.Start call;
- in the Application_Start method of the ASP.NET application located in the Global.asax.cs (Global.asax.vb) file, before the WebApplication.Start call.
The Solution Wizard uses the second and third locations.
Reload Permission Strategies
Security Adapters support various modes of reloading the security permissions. The available modes are listed in the ReloadPermissionStrategy enumeration. There is an overload of the SecurityAdapterHelper.Enable method that takes the reloadPermissionStrategy parameter - use it to change the mode. By default, the NoCache mode is used. Each Session (in XPO) or DBContext (in Entity Framework) operates with the most recent permissions loaded from the database in this mode. You can use the CacheOnFirstAccess mode instead. Permissions are loaded and cached when the corresponding secured data is accessed for the first time, cached permissions are used until the user is logged off in this mode. This mode allows you to significantly reduce the number of database requests when working with secured data.
安全适配器支持各种重新加载安全权限的模式。可用模式在 ReloadPermissionStrategy 枚举中列出。SecurityAdapterHelper 的重载. 启用采用 reloadPermissionStrategy 参数的方法-使用它来更改模式。默认情况下, 使用缓存模式。每个会话 (在 xpo 中) 或 DBContext (在实体框架中) 都使用此模式中从数据库加载的最新权限。您可以改用 CacheOnFirstAccess 模式。当第一次访问相应的安全数据时, 将加载和缓存权限, 直到用户在此模式下注销时才使用缓存的权限。此模式允许您在使用安全数据时显著减少数据库请求的数量。
Security Permissions Caching的更多相关文章
- CRM 2016 请求"System.Security.Permissions.FilelOPermission,mscorlib,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089"类型的权限已失败.
CRM 请求"System.Security.Permissions.FilelOPermission,mscorlib,Version=4.0.0.0,Culture=neutral,Pu ...
- dotnetnuke 调用第三方dll出错 System.Security.Permissions.SecurityPermission,型的权限已失败。
在dnn下调用第三方dll的微信sdk ,代码如下: WebClient wc = new WebClient(); wc.Encoding = encoding ?? Encoding.UTF8; ...
- java Permissions and Security Policy--官方文档
3 Permissions and Security Policy 3.1 The Permission Classes The permission classes represent access ...
- [XAF] How to use the Allow/Deny permissions policy in the existing project
https://www.devexpress.com/Support/Center/Question/Details/T418166 Clear [C#] using DevExpress.Persi ...
- Page Security
参见开发文档 Overview This document describes how to build applications that grant selected access to indi ...
- Application Designer Security
This wiki page covers how to manage and restrict Application Designer security through permission li ...
- (C#)为应用程式设定运行权限(System.Security类下的GenericIdentity,GenericPrincipal,PrincipalPermission)
最近看书<编写高质量代码改善C#程序的157个建议>,知识点备忘: System.Security.Principal.GenericIdentity==>表示一般用户 System ...
- Android API Guides –System Permissions
系统权限 声明: 本文由Gordon翻译 公布于www.dlvoice.com 欢迎转载,但请保留此声明 原文地址:http://developer.android.com/guide/topics/ ...
- File and Folder Permissions
https://msdn.microsoft.com/en-us/library/bb727008.aspx On NTFS volumes, you can set security permiss ...
随机推荐
- XXX esx.problem.hyperthreading.unmitigated.formatOnHost not found XXX (Build 9313334)
昨天把一台服务器(VMware ESXi, 6.0.0, 5572656)更新了一下补丁,更新到最新版(VMware ESXi, 6.0.0, 9313334),服务器重启后,vCenter出现以下错 ...
- matlab中关于函数句柄、feval函数以及inline函数的解析 (转)
http://blog.sina.com.cn/s/blog_7bff755b010180l3.html MATLAB函数句柄 函数句柄(Function handle)是MATLAB的一种数据类型. ...
- 数据库学习之中的一个: 在 Oracle sql developer上执行SQL必知必会脚本
1 首先在開始菜单中打开sql developer: 2. 创建数据库连接 点击左上角的加号 在弹出的对话框中填写username和password 測试假设成功则点击连接,记得角色要写SYSDBA ...
- 线性dp
线性dp应该是dp中比较简单的一类,不过也有难的.(矩乘优化递推请出门右转) 线性dp一般是用前面的状态去推后面的,也有用后面往前面推的,这时候把循环顺序倒一倒就行了.如果有的题又要从前往后推又要从后 ...
- Day5 JavaScript(三)事件、表单验证以及初识jQuery
事件 1)鼠标事件 mousedown mouseup 2)键盘事件 a) keydown:键被按下 b) keyup:键抬起 c) keypress:按下可打印字符的键时. document.onk ...
- React-Native 之 index.android.bundle
问题: index.android.bundle 这个bug 我相信很少同学会遇到,然而就是这个问题,困扰了我跟我的同事多天, 各种方法处理: 进入 android 目录 ./gradlew c ...
- 2、JVM--Java内存区域与内存溢出异常
Java与C++之间有一堵由内存动态分配和垃圾收集技术所围成的“高墙”,墙外面的人想进去,墙里面的人却想出来. 2.1.概述 对于从事C.C++程序开发的开发人员来说,在内存管理领域,他们既是拥有最高 ...
- linq to sql 和linq to php 的区别
linq to sql 这是自.net框架3.5版本以上做出了相关规定. linq to php .Net的linq库的忠实移植到PHP 这个库使得大量使用匿名函数在PHP 5.3中引入的功能.因此, ...
- Mysql 多实例实施步骤
基本理论:利用同一套安装程序,不同配置文件,不同启动程序,不同数据目录.有公用资源,也有私有资源. 实现步骤: 1.正常安装mysql,二进制安装或者编译安装. 2.创建mysql多实例总目录,总目录 ...
- Uva442
https://vjudge.net/problem/UVA-442 思路: 1)当遇到左括号将字母进栈,遇到右括号将字母出栈. 2) isalpha() 判断一个字符是否是字母 int isalph ...