public TResult Dispatch <TParameter, TResult>(TParameter query) where TParameter : IQuery where TResult : IQueryResult { var stopwatch = new Stopwatch(); stopwatch.Start(); IQueryHandler <TParameter, TResult> handler = null; try { handler = _container.Resolve <IQueryHandler <TParameter, TResult> >(); var results = handler.Retrieve(query); stopwatch.Stop(); return(results); } catch (Exception ex) { stopwatch.Stop(); throw; } finally { handler.Dispose(); } }
public void Dispose() { _decoratedHndl.Dispose(); }