Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set Hybrid Lifestyle as the LifeStyleType #7

Open
PandaWood opened this issue Sep 1, 2017 · 0 comments
Open

How to set Hybrid Lifestyle as the LifeStyleType #7

PandaWood opened this issue Sep 1, 2017 · 0 comments

Comments

@PandaWood
Copy link

PandaWood commented Sep 1, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant