public static HotChocolateActivity GetActivity(this IHasContextData context)
 {
     if (context.ContextData.TryGetValue(nameof(HotChocolateActivity), out object value) &&
         value is HotChocolateActivity activity)
     {
         return(activity);
     }
     throw new InvalidOperationException();
 }
Exemplo n.º 2
0
        public static IReadOnlyDictionary <NameString, IRequestExecutor> GetRemoteExecutors(
            this IHasContextData hasContextData)
        {
            if (hasContextData.ContextData.TryGetValue(RemoteExecutors, out object?o) &&
                o is IReadOnlyDictionary <NameString, IRequestExecutor> executors)
            {
                return(executors);
            }

            throw RequestExecutorBuilder_RemoteExecutorNotFound();
        }
Exemplo n.º 3
0
        public static IReadOnlyDictionary <NameString, IRequestExecutor> GetRemoteExecutors(
            this IHasContextData hasContextData)
        {
            if (hasContextData.ContextData.TryGetValue(RemoteExecutors, out object?o) &&
                o is IReadOnlyDictionary <NameString, IRequestExecutor> executors)
            {
                return(executors);
            }

            // TODO : throw helper
            throw new InvalidOperationException(
                      "The mandatory remote executors have not been found.");
        }
 public static void SetActivity(this IHasContextData context, HotChocolateActivity activity)
 {
     context.ContextData[nameof(HotChocolateActivity)] = activity;
 }
 public static HotChocolateRequest GetRequest(this IHasContextData context) =>
 context.GetActivity().Request;
Exemplo n.º 6
0
 private static bool IsValidateDescriptorApplied(IHasContextData thing)
 {
     return(IsValidateDescriptorApplied(thing.ContextData));
 }