-
Notifications
You must be signed in to change notification settings - Fork 527
Open
Milestone
Description
When building command processors which need to deterministically release dependent IDisposable resources, one often needs to perform a sequence as follows:
var handler = _kernel.Get( typeof(T) );
try
{
handler.Handle( request)
}
finally
{
_kernel.Release( handler );
}
It would be neat to have support in Ninject.Extensions.Factory to allow one to define an interface as follows and have it auto-implemented:
interface IHandlerFactory
{
void CreateRunAndRelease(Action action);
void CreateRunAndRelease(Type service, Action action);
}
Side note: This would probably build on a lower level Ninject.Extensions.NamedScope facility to create an IDisposable RAII ScopeBlock object (i.e., a proper reimplementation of Activation Blocks)
Metadata
Metadata
Assignees
Labels
No labels