Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleManager.Resolve C# (CSharp) Method

Resolve() public method

public Resolve ( CreationContext context ) : object
context Castle.MicroKernel.Context.CreationContext
return object
		public override object Resolve(CreationContext context)
		{
			HttpContext current = HttpContext.Current;

			if (current == null)
				throw new InvalidOperationException(
					"HttpContext.Current is null.  PerWebRequestLifestyle can only be used in ASP.Net");

			if (current.Items[PerRequestObjectID] == null)
			{
				if (!PerWebRequestLifestyleModule.Initialized)
				{
					string message = "Looks like you forgot to register the http module " +
					                 typeof(PerWebRequestLifestyleModule).FullName +
					                 "\r\nAdd '<add name=\"PerRequestLifestyle\" type=\"Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.MicroKernel\" />' " +
					                 "to the <httpModules> section on your web.config";

					throw new ConfigurationErrorsException(message);
				}

				object instance = base.Resolve(context);
				current.Items[PerRequestObjectID] = instance;
				PerWebRequestLifestyleModule.RegisterForEviction(this, instance);
			}

			return current.Items[PerRequestObjectID];
		}
PerWebRequestLifestyleManager