1 using System
.Runtime
.Remoting
.Messaging
;
2 using Castle
.MicroKernel
.ComponentActivator
;
3 using Castle
.MicroKernel
.Lifestyle
;
5 namespace Castle
.MVC
.LifestyleManager
8 /// PerRequestLifestyleManager.
9 /// Create only one instance of the controller per request
11 public class PerRequestLifestyleManager
: AbstractLifestyleManager
13 private const string PERREQUESTLIFESTYLEMANAGER
= "_PERREQUESTLIFESTYLEMANAGER_";
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
);
33 public override void Dispose()