public Task <string> HandleAsync(
            IQueryHandlingContext <GetGreetingForCurrentUser> context,
            CancellationToken cancellationToken = default)
        {
            var greeting = $"Hi, {ExecutionContext.CurrentUser.Name}!";

            return(Task.FromResult(greeting));
        }
Beispiel #2
0
 public Task Invoke(
     IQueryHandlingContext context,      //Context. Required argument
     IPipe <IQueryHandlingContext> next, //Next filter in pipeline. Required argument,
     IScopedService scopedService        //Scoped dependency. Will be resolved from dependency resolver of current scope.
                                         //Optional argument
     )
 {
     return(next.Send(context));
 }
 public Task <string> HandleAsync(
     IQueryHandlingContext <SomeBuggyQuery> context,
     CancellationToken cancellationToken = default)
 {
     throw new InvalidOperationException(context.Query.ExceptionText);
 }
 public Task <string> HandleAsync(
     IQueryHandlingContext <SomeQuery> context,
     CancellationToken cancellationToken = default)
 {
     return(Task.FromResult(context.Query.SomeProperty));
 }
 public Task <Either <string, ValidationState> > HandleAsync(
     IQueryHandlingContext <TestQueryWithEitherResult> context,
     CancellationToken cancellationToken = default)
 {
     return(Task.FromResult(new Either <string, ValidationState>("Some result")));
 }
 public Task <string> HandleAsync(
     IQueryHandlingContext <TestQuery> context,
     CancellationToken cancellationToken = default)
 {
     return(Task.FromResult("Some result"));
 }