public async Task <TResult> Run <TResult>(IQuery <TResult> query) { var attribute = query.GetAttribute(); TResult result = default; if (attribute != null) { result = await _queryCache.GetData(query); } if (result is null) { var handler = _resolver.Resolve <IQueryHandler <IQuery <TResult>, TResult> >(); result = await handler.Handle(query); if (attribute != null && result != null) { await _queryCache.SetData(query, result); } } return(result); }