惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
S
Secure Thoughts
T
Tailwind CSS Blog
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
Troy Hunt's Blog
阮一峰的网络日志
阮一峰的网络日志
博客园 - 叶小钗
博客园 - 司徒正美
NISL@THU
NISL@THU
小众软件
小众软件
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
T
Threat Research - Cisco Blogs
Hacker News: Ask HN
Hacker News: Ask HN
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园_首页
罗磊的独立博客
S
Securelist
N
News | PayPal Newsroom
大猫的无限游戏
大猫的无限游戏
T
Tenable Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Visual Studio Blog
爱范儿
爱范儿
Spread Privacy
Spread Privacy
V2EX - 技术
V2EX - 技术
J
Java Code Geeks
V
V2EX
人人都是产品经理
人人都是产品经理
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
I
Intezer
腾讯CDC
P
Privacy & Cybersecurity Law Blog
SecWiki News
SecWiki News
Google DeepMind News
Google DeepMind News
P
Palo Alto Networks Blog
Cloudbric
Cloudbric
Apple Machine Learning Research
Apple Machine Learning Research
N
News and Events Feed by Topic
Latest news
Latest news
L
LINUX DO - 最新话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
博客园 - 【当耐特】
Last Week in AI
Last Week in AI
The Cloudflare Blog

博客园 - 程序员海风

cef加载flash的办法 一个高性能的对象属性复制类,支持不同类型对象间复制,支持Nullable<T>类型属性 php检测php.ini是否配制正确 openwrt的路由器重置root密码 windows 7 + vs2010 sp1编译 x64位版qt4 解决SourceGrid在某些系统上无法用鼠标滚轮滚动的问题 判断一个点是否在多边形内部,射线法思路,C#实现 [转载]使用HttpWebRequest进行请求时发生错误:基础连接已关闭,发送时发生错误处理 让Dapper+SqlCE支持ntext数据类型和超过4000字符的存储 通过WMI - Win32_Processor - ProcessorId获取到的并不是CPU的序列号,也并不唯一 DataGridView中设置固定行高 csExWB Webbrowser禁止flash内容的显示 使用csExWB Webbrowser 控件获取HttpOnly的cookie 禁用IIS FTP默认的连接提示信息:“220-Microsoft FTP Service” C#使用RSA私钥加密公钥解密的改进,解决特定情况下解密后出现乱码的问题 Windows7的KB2488113补丁很重要,解决Windows7下软件无响应的问题 OpenFileDialog和SaveFileDialog使用不当会有文件夹共享冲突的问题 Cache-Control:nocache 会导致ie浏览器无法保存正确的图片类型 安装阿里旺旺2008会导致IE Webcontrols在客户端显示不正常
在ASP.NET的单次请求中使用Singleton模式
程序员海风 · 2011-04-27 · via 博客园 - 程序员海风

代码:

public class SingletonPerRequest
{
    
public static SingletonPerRequest Current
    {
        
get
        {
            
return (HttpContext.Current.Items["SingletonPerRequest"??
                (HttpContext.Current.Items[
"SingletonPerRequest"= 
                
new SingletonPerRequest())) as SingletonPerRequest;

        }
    }
}

详见:http://dotnetslackers.com/community/blogs/simoneb/archive/2006/08/21/The-ASP.NET-Singleton_2D00_per_2D00_Request-pattern.aspx

posted @ 2011-04-27 09:05  程序员海风  阅读(369)  评论()    收藏  举报