<http://stackoverflow.com/questions/13557773/how-to-use-perwcfsession-lifestyle-by-default-since-theres-no-lifestyletype-wc#>
I use a class (like below) to set the default to transient construction in
Castle 2.5. But I have a WCF project and I'd like to have a default of *
PerWcfSession*.
I can wire this up on a case by case basis, with WcfIntegration:
w.Register(Component.For<IFoo>().ImplementedBy<Foo>().LifeStyle.PerWcfSession());
But I'd really like to setup a WcfPerSessionConstruction as I do elsewhere,
as per the class below.
But I can't see how to set the LifestyleType since there is no enumeration
for PerWcfSession. I can see I probably need "Custom" but not what to do
from there.
In summary, I want to convert this class below to a
PerWcfSessionConstruction but cannot see or understand what to set in order
for it to work.
public class TransientConstruction : IContributeComponentModelConstruction
{
public void ProcessModel(IKernel kernel, ComponentModel model)
{
if (model.LifestyleType == LifestyleType.Undefined)
model.LifestyleType = LifestyleType.Transient;
//LifestyleType.PerWcfSession?
}
}
container.Kernel.ComponentModelBuilder.AddContributor(new
TransientConstruction())
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/castle-project-users/-/-D1mF_3NWswJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.