/// <summary> /// Execute query /// </summary> /// <typeparam name="TResult">Query result type</typeparam> /// <param name="query">Query to execute</param> /// <returns>result</returns> /// <exception cref="ArgumentNullException">query</exception> /// <exception cref="OnlyOneQueryHandlerAllowedException">If multiple handlers have been registered for the query</exception> /// <exception cref="NoHandlerRegisteredException">A handler have not been registered for the given query</exception> public async Task <TResult> QueryAsync <TResult>(Query <TResult> query) { if (query == null) { throw new ArgumentNullException(nameof(query)); } var ctx = new ExecuteQueriesInvocationContext(null, _messageInvoker); return(await ctx.QueryAsync(query)); }
public async Task <TResult> QueryAsync <TResult>(Query <TResult> query) { var ctx = new ExecuteQueriesInvocationContext(Principal, _messageInvoker); return(await ctx.QueryAsync(query)); }