博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Autofac.Integration.Mvc分析
阅读量:6421 次
发布时间:2019-06-23

本文共 2650 字,大约阅读时间需要 8 分钟。

Autofac.Integration.Mvc

 

static ILifetimeScope LifetimeScope        {            get { return (ILifetimeScope)HttpContext.Current.Items[typeof(ILifetimeScope)]; }            set { HttpContext.Current.Items[typeof(ILifetimeScope)] = value; }        }
namespace Autofac.Integration.Mvc{    ///     /// An 
and
implementation /// that creates a nested lifetime scope for each HTTP request. ///
internal class RequestLifetimeHttpModule : IHttpModule { /// /// Gets the lifetime scope provider that should be notified when a HTTP request ends. /// internal static ILifetimeScopeProvider LifetimeScopeProvider { get; private set; } /// /// Initializes a module and prepares it to handle requests. /// /// An
that provides access to the /// methods, properties, and events common to all application objects within an ASP.NET application ///
/// Thrown if
is
. ///
public void Init(HttpApplication context) { if (context == null) { throw new ArgumentNullException("context"); } context.EndRequest += OnEndRequest; } /// /// Disposes of the resources (other than memory) used by the module that implements
. ///
public void Dispose() { } public static void SetLifetimeScopeProvider(ILifetimeScopeProvider lifetimeScopeProvider) { if (lifetimeScopeProvider == null) throw new ArgumentNullException("lifetimeScopeProvider"); LifetimeScopeProvider = lifetimeScopeProvider; } static void OnEndRequest(object sender, EventArgs e) { if (LifetimeScopeProvider != null) LifetimeScopeProvider.EndLifetimeScope(); } }}
using System.ComponentModel;using Microsoft.Web.Infrastructure.DynamicModuleHelper;namespace Autofac.Integration.Mvc{    ///     /// Container class for the ASP.NET application startup method.    ///     [EditorBrowsable(EditorBrowsableState.Never)]    public static class PreApplicationStartCode    {        private static bool _startWasCalled;        ///         /// Performs ASP.NET application startup logic early in the pipeline.        ///         public static void Start()        {            // Guard against multiple calls. All Start calls are made on the same thread, so no lock needed here.            if (_startWasCalled) return;            _startWasCalled = true;            DynamicModuleUtility.RegisterModule(typeof(RequestLifetimeHttpModule));        }    }}

 

转载地址:http://zcpra.baihongyu.com/

你可能感兴趣的文章
Java操作redis
查看>>
UML
查看>>
PostgreSQL merge json的正确姿势
查看>>
java反射
查看>>
【IOS-COCOS2D游戏开发之二】COCOS2D 游戏开发资源贴(教程以及源码)
查看>>
nodejs安装记录
查看>>
Android2.2 API 中文文档系列(9) —— ZoomButton
查看>>
《银行的一天》演示日志处理保序、不丢、不重
查看>>
《APUE》读书笔记—第十章信号(下)
查看>>
[LeetCode] Remove Invalid Parentheses
查看>>
使用iptables做端口转发访问ftp
查看>>
谈谈eclipse使用技巧二
查看>>
从Social Media海量数据中寻找专家的五大手法
查看>>
Hadoop2源码分析-HDFS核心模块分析
查看>>
iOS开发UI篇—无限轮播(循环利用)
查看>>
初试物化视图
查看>>
Midletinfo-探索手机javaME系统信息的实用工具
查看>>
【MySQL】MySQL性能优化之Block Nested-Loop Join(BNL)
查看>>
Node.js数据流Stream之Readable流和Writable流
查看>>
使用openURL实现程序间带参数跳转详解
查看>>