I am a Castle Winsor Noob. I have a WebForm project that is a hot mess. I am trying to resolve a dependency to test user registration. How do I get to the current WindsorContainer?
IWindsorContainer container = ???;
IRegistrationLogic registrationLogic = container.Resolve<IRegistrationLogic>();
_registrationLogic.Register();
Here is my Bootstrapper:
public class WindsorConfigTask : ICastleBootstrapperTask
{
public void Execute()
{
Container.AddFacility<WcfFacility>();
Container.Register(
Component.For<IProcessMessageRequest>()
.ActAs(
new DefaultClientModel
{
Endpoint =
WcfEndpoint.ForContract<IProcessMessageRequest>().FromConfiguration("surveyClient2")
}
),
Component.For<ILocalMembershipService>()
.ActAs(
new DefaultClientModel
{
Endpoint =
WcfEndpoint.ForContract<ILocalMembershipService>().FromConfiguration(
"localMembershipClient")
})
);
Container.Register(Component.For<IRegistrationLogic>()
.ImplementedBy<RegistrationLogic>()
.LifeStyle.Is(LifeStyleType));
}
public IWindsorContainer Container { get; set; }
#region ICastleBootstrapperTask Members
public Castle.Core.LifestyleType LifeStyleType
{
get;
set;
}
#endregion
}