Basically as soon as I started using Windsor, I wrote custom
LifestyleManagers for DisposableSingleton and DisposablePerThread
lifestyles, because the default Singleton and PerThread Lifestyles do
not allow releasing.
Why do I want this? Take the following scenario (note that I'm not
actually using container.Resolve and Release in the real world).
var unitOfWork = container.Resolve<IUnitOfWork>();
DoSomeWork();
DoSomeMoreWork();
container.Release(unitOfWork);
public static void DoSomeWork()
{
var repository = container.Resolve<IRepository1>(); //
IRepository1 has a constructor that takes an IUnitOfWork...and we want
it to get the IUnitOfWork in context.
}
public static void DoSomeMoreWork()
{
var repository = container.Resolve<IRepository2>(); //
IRepository2 has a constructor that takes an IUnitOfWork...and we want
it to get the IUnitOfWork in context.
}
So, am I doing something bad here or is there a reason Windsor
shouldn't support this scenario by default?
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
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.