This is actually an answer to fellow blogger Jak Charlton, but I see a benefit in sharing it.
Casey pointed out that the default lifestyle should be transient. Even though I understand his reasonings, I am used to this way.
There is a solution for those who wants Transient as the default.
You know what? Yes, the events ! Here is how.
container.Kernel.ComponentModelCreated += new ComponentModelDelegate(Kernel_ComponentModelCreated);
void Kernel_ComponentModelCreated(Castle.Core.ComponentModel model)
{
if (model.LifestyleType == LifestyleType.Undefined)
model.LifestyleType = LifestyleType.Transient;
}
Posted
08-06-2009 1:30 PM
by
Tuna Toksoz