Re: UsingFactoryMethod doesn't release PerWebRequest components

2011-09-06 Thread thuannguy
What if I release the components manually by using the ComponentDestroyed event? Is there anything wrong with this? static void Kernel_ComponentDestroyed(ComponentModel model, object instance) { if (model.LifestyleType == LifestyleType.PerWebRequest) masterContainer.K

Re: UsingFactoryMethod doesn't release PerWebRequest components

2011-09-06 Thread thuannguy
According to the following comment in PerWebRequestLifestyleManager, it sounds like UsingFactoryMethod and PerWebRequest are not compatible to each other as-is public override bool Release(object instance) { // Since this method is called by

UsingFactoryMethod doesn't release PerWebRequest components

2011-09-05 Thread thuannguy
Briefly speaking, our system uses UsingFactoryMethod in a few places like the following: container.Register(Component .For() .UsingFactoryMethod(k => new SqlRepositoryRegistry(this.connectionString, _schema))