Esempio n. 1
0
        private async Task <Result> Handle <TResource, TInput>(MutationRequest request, TInput input)
        {
            _telemetry.TrackRequest <TResource, TInput>(request, GrainId());

            if (!CreateRequest(request, input) && !State.Exists && !ImplicitCreateAllowed())
            {
                return(NotFound <TResource, TInput>());
            }

            try
            {
                var events = await HandleEvent <T, TResource, TInput>(request, input);

                var success = !events.Any(e => e is Rejected <TInput>);
                return(success ? Result.Ok(events) : Result.Nok(events));
            }
            catch (Exception ex)
            {
                await HandleException <TResource, TInput>(request, input, ex);

                throw;
            }
        }