perwebrequest

PerWebRequest Lifestyle missing in Castle Windsor 3.2

喜夏-厌秋 提交于 2019-12-24 10:56:34
问题 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 'PerWebRequest' accepting a first argument of type 'Castle.MicroKernel.Registration.Lifestyle.LifestyleGroup<.... Below is how I was registering the Component, but with the latest version it throws error: container.Register(Component.For<IUserRepository>()

castle PerRequestLifestyle not recognize

筅森魡賤 提交于 2019-12-19 08:23:19
问题 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 following: container.Register(Component.For<HttpContextBase>().LifeStyle.Transient.UsingFactoryMethod(() => new HttpContextWrapper(HttpContext.Current))); What I wanted to do is to change the behavior and change the lifestyle of httpContextBase to be PerWebRequest. so I have change the code to the following: container

Testing Castle windsor Component with PerWebRequest lifestyle

我怕爱的太早我们不能终老 提交于 2019-12-18 12:58:09
问题 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 component has PerWebRequest lifestyle in its installer, at first it complained about HttpContext.Current is null, having that one solved creating a fake Context in test setup I'm now having this exception in nunit test System.Exception : Looks like you

Castle Windsor PerWebRequest LifeStyle and Application_EndRequest

风格不统一 提交于 2019-12-11 06:24:51
问题 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 want to call commit on my UnitOfWork object to submitchanges() at the end of every request. In addition to using the Global.asax Application_EndResult, I've also tried an IHttpModule with the same results. I'm using Castle 2.0. Here's how I'm

How to use Castle Windsor's PerWebRequest lifestyle with OWIN

不打扰是莪最后的温柔 提交于 2019-12-10 04:34:02
问题 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 a Castle.MicroKernel.ComponentResolutionException exception. The exception recommends adding the following to the system.web/httpModules and system.WebServer/modules sections in the config file: <add name="PerRequestLifestyle" type="Castle

How to use Castle Windsor's PerWebRequest lifestyle with OWIN

折月煮酒 提交于 2019-12-05 07:29:28
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 a Castle.MicroKernel.ComponentResolutionException exception. The exception recommends adding the following to the system.web/httpModules and system.WebServer/modules sections in the config file: <add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" /> This doesn't resolve the error. Taking

castle PerRequestLifestyle not recognize

早过忘川 提交于 2019-12-01 05:48:27
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 following: container.Register(Component.For<HttpContextBase>().LifeStyle.Transient.UsingFactoryMethod(() => new HttpContextWrapper(HttpContext.Current))); What I wanted to do is to change the behavior and change the lifestyle of httpContextBase to be PerWebRequest. so I have change the code to the following: container.Register(Component.For<HttpContextBase>().LifeStyle.PerWebRequest.UsingFactoryMethod(() => new