Added ability to order the execution of dictionary adapter behaviors.
[castle.git] / Experiments / Attic / MVC / Castle.MVC / LifestyleManager / PerRequestLifestyleManager.cs
blob84681001d8bfe460f75104daa68732482e7a814f
1 using System.Runtime.Remoting.Messaging;
2 using Castle.MicroKernel.ComponentActivator;
3 using Castle.MicroKernel.Lifestyle;
5 namespace Castle.MVC.LifestyleManager
7 /// <summary>
8 /// PerRequestLifestyleManager.
9 /// Create only one instance of the controller per request
10 /// </summary>
11 public class PerRequestLifestyleManager: AbstractLifestyleManager
13 private const string PERREQUESTLIFESTYLEMANAGER = "_PERREQUESTLIFESTYLEMANAGER_";
15 /// <summary>
16 ///
17 /// </summary>
18 /// <returns></returns>
19 public override object Resolve()
21 string componentName = PERREQUESTLIFESTYLEMANAGER+(this.ComponentActivator as AbstractComponentActivator).Model.Name;
22 if( CallContext.GetData(componentName) == null)
24 CallContext.SetData(componentName, base.Resolve ());
27 return CallContext.GetData(componentName);
30 /// <summary>
31 ///
32 /// </summary>
33 public override void Dispose()