Questions tagged [perwebrequest]

15 questions
19
votes
4 answers

Testing Castle windsor Component with PerWebRequest lifestyle

I'm trying to do some testing with castle windsor involved, in one of my tests I want to check the windsor installers, so I check that the container can resolve my components given its interface. So far, so good, the problem starts when the…
6
votes
3 answers

How to use Castle Windsor's PerWebRequest lifestyle with OWIN

I am converting an existing ASP .Net Web API 2 project to use OWIN. The project uses Castle Windsor as the dependency injection framework with one of the dependencies set to use the PerWebRequest lifestyle. When I make a request to the server I get…
Talon
  • 143
  • 1
  • 7
5
votes
2 answers

castle PerRequestLifestyle not recognize

New to Castle/Windsor, please bear with me. I am currently using the framework System.Web.Mvc.Extensibility and in its start up code, it registered HttpContextBase like the…
Herman
  • 3,004
  • 5
  • 37
  • 49
5
votes
1 answer

What is the correct 'per request' Simple Injector lifestyle to use in a ServiceStack API application?

I have a ServiceStack API application which uses Simple Injector as its IoC container. I need certain components to have a 'per web request' lifestyle. I looked up in the Simple Injector documentation here, and found that it has not one, but two…
David
  • 15,750
  • 22
  • 90
  • 150
3
votes
1 answer

Some objects created with PerWebRequest are not garbage collected at the end of web request

Given public class a : IDisposable { public static int counter; public a() { counter++; } ~a() { counter--; } public void Dispose() { } } With registration: application_container = new…
mbergal
  • 635
  • 6
  • 13
3
votes
2 answers

Castle Windsor 3 persists PerWebRequest objects across multiple web requests

I have an MVC 4 project and am trying to inject a PerWebRequest object into my controller. However it appears the object is not being recreated across multiple requests private static IWindsorContainer InitializeWindsor() { var…
doglobster
  • 116
  • 8
2
votes
3 answers

Windsor PerWebRequest resolution in Application_Start

I am injecting HttpContextBase into a caching class. HttpContextBase is registered as PerWebRequest. I interact with the caching class on each web request and this works fine, but I also need to initialise the cache at application start. I…
Paul Hiles
  • 9,558
  • 7
  • 51
  • 76
2
votes
2 answers

Integrate Pooled Lifestyle with PerWebRequest Lifestyle in Windsor

I have ASP.NET MVC application that uses Entity Framework as ORM. Now I'm using PerWebRequest lifestyle for EF ObjectContext. While profiling application performance under high load, I found a bottleneck in ObjectContext creation. I want to change…
Dmitriy Startsev
  • 1,442
  • 10
  • 19
2
votes
0 answers

Castle 3.0 does not dispose an Entity Framework.DbContext component when configured with LifeStyle.PerWebRequest

Wondering if anyone has encountered this weird behaviour with Castle Windsor 3.0? I've set up the Container Configuration for the DbContext to have a lifestyle of PerWebRequest, but Castle does not dispose the Component after a WebRequest. It keeps…
Kwex
  • 3,992
  • 1
  • 35
  • 28
1
vote
1 answer

Setting PerWebRequest Lifestyle In NHibernate

I have a pretty basic NHibernate setup. I am not using Castle Widnsor or anything special like that to do IoC in my code. All I want to do is set my Lifestyle to PerWebRequest, but I cannot figure out how to do this with out going back through my…
Nick Berardi
  • 54,393
  • 15
  • 113
  • 135
1
vote
2 answers

Castle Windsor PerWebRequest LifeStyle and Application_EndRequest

I'm registering some components related to Linq2Sql using PerWebRequest lifestyle. I see them get created, but they get destroyed before my global's Application_EndRequest method gets called. Is that by design? Does anyone know a work around? I…
Corey Coogan
  • 1,569
  • 2
  • 17
  • 31
1
vote
0 answers

PerWebRequest Lifestyle missing in Castle Windsor 3.2

I was using PerWebRequest Lifestyle from Castle Windsor(version 3.0.0.4001). I wanted to update it to the latest version (3.2). In the latest version the, it says does not contain a definition for 'PerWebRequest' and no extension method…
Prasad
  • 58,881
  • 64
  • 151
  • 199
0
votes
0 answers

How per web request life cycle works in IoC libraries work

I want to implement a DI in any language that I want.Thus, I have to know how life cycles works in inversion-of-control. for example to implement singleton, I can have a static collection to provide the same instance Now I want to know when in an …
0
votes
1 answer

LightInject PerWebRequest Interception

This is specific to LightInject's interception. Is it possible to apply interception logic based on PerWebRequest lifetime so that interception logic can be conditionally turned on/off based on user input? E.g. something like this. public static…
0
votes
1 answer

Castle Windsor: PerWebRequest in controller

I am using Castle Windsor in MVC application and i have got this problem: I have IUnitOfWorkProvider dependency which I want to have PerWebRequest lifestyle. In Controller I have these two dependecies: public class UserController : Controller { …