castleproject-deprecated / castle.windsor.lifestyles Goto Github PK
View Code? Open in Web Editor NEWAdditional lifestyles for Castle.Windsor
License: Apache License 2.0
Additional lifestyles for Castle.Windsor
License: Apache License 2.0
Hello,
is there any option to have a HybridPerWebRequestPerScope lifestyle?
I'm using NServiceBus inside a WebApplication and I need some components to live both in the web app (PerWebRequest) and in the message handling scope generated by NSB per received message.
cheers,
.m
Hi there, thanks for these lifestyles!
I can easily use them the Component.For registration method like so:
container.Register(Component.For<IUserStore<ApplicationUser, int>>().ImplementedBy<UserStore>().LifeStyle.HybridPerWebRequestPerThread());
But how do I use them with the Classes.FromAssembly registration method?
container.Register(Classes.FromAssembly(Assembly.GetAssembly(typeof(Manager<>))).BasedOn(typeof(Manager<>)).LifestylePerWebRequest());
This returns BasedOnDescriptor instead of ComponentRegistration, so I'm not sure how to use these lifestyles with this registration.
Thanks for any insight,
Pete
Hello,
Now that this module is deprecated, what is the suggested replacement for Lifestyle.HybridPerWebRequestPerThread()? I think I will switch to LifestylePerWebRequest() but am nervous because this affects our database context. Thanks!
Hey
I can see how to register a single type but we set the entire web site to use PerWebRequest as per this post - http://blog.ploeh.dk/2010/04/26/ChangingWindsorlifestylesafterthefact/
In that case, we need to explicitly set the "LifeStyleType" propertly on the ComponentModel.
I'm not sure what I would set this to - and what else to do - in order to spread the Hybrid lifestyle
public class SingletonEqualizer : IContributeComponentModelConstruction
{
public void ProcessModel(IKernel kernel, ComponentModel model)
{
model.LifestyleType = LifestyleType.Singleton; // what to set this to?
}
}
I've tried below, but there's no ILifestyleManager for PerWebRequest (and I understand Windsor 3 now uses new ScopedLifestyleManager(new WebRequestScopeAccessor()
So how to encapsulate that, I really don't know - something like below, if ScopedLifestyle had a way of specifying the underlying type without newing it up)
model.CustomLifestyle = typeof(HybridLifestyleManager<ScopedLifestyleManager>, TransientLifestyleManager>);
Constructor on type 'Castle.MicroKernel.Lifestyle.HybridLifestyleManager`2[[Castle.MicroKernel.Lifestyle.ScopedLifestyleManager, Castle.Windsor, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc],[Castle.MicroKernel.Lifestyle.TransientLifestyleManager, Castle.Windsor, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc]]' not found.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.