Ejemplo n.º 1
0
            public override void OnBeforeInitialize(ITypeDiscoveryContext discoveryContext)
            {
                if (!ReferenceEquals(_watch, discoveryContext.Type))
                {
                    discoveryContext.RegisterDependency(
                        new TypeDependency(TypeReference.Create(_watch)));

                    discoveryContext.RegisterDependency(
                        new TypeDependency(TypeReference.Create(new ListType(_watch))));
                }
            }
Ejemplo n.º 2
0
        public static void RegisterDependencies(
            this ITypeDiscoveryContext context,
            InputObjectTypeDefinition definition)
        {
            if (context is null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (definition is null)
            {
                throw new ArgumentNullException(nameof(definition));
            }

            RegisterAdditionalDependencies(context, definition);
            RegisterDirectiveDependencies(context, definition);

            foreach (InputFieldDefinition field in definition.Fields)
            {
                RegisterAdditionalDependencies(context, field);

                if (field.Type is not null)
                {
                    context.RegisterDependency(field.Type,
                                               TypeDependencyKind.Default);
                }

                context.RegisterDependencyRange(
                    field.GetDirectives().Select(t => t.TypeReference),
                    TypeDependencyKind.Completed);
            }
        }
Ejemplo n.º 3
0
        protected override void OnRegisterDependencies(
            ITypeDiscoveryContext context,
            ObjectTypeDefinition definition)
        {
            base.OnRegisterDependencies(context, definition);

            context.RegisterDependency(
                context.TypeInspector.GetTypeRef(typeof(EdgeType <T>)),
                TypeDependencyKind.Default);
        }
Ejemplo n.º 4
0
        protected override void OnRegisterDependencies(
            ITypeDiscoveryContext context,
            ObjectTypeDefinition definition)
        {
            base.OnRegisterDependencies(context, definition);

            context.RegisterDependency(
                TypeReference.Create <EdgeType <T> >(),
                TypeDependencyKind.Default);
        }
Ejemplo n.º 5
0
        private static void RegisterFieldDependencies(
            this ITypeDiscoveryContext context,
            IEnumerable <ArgumentDefinition> fields)
        {
            foreach (ArgumentDefinition field in fields)
            {
                RegisterAdditionalDependencies(context, field);

                if (field.Type is not null)
                {
                    context.RegisterDependency(field.Type,
                                               TypeDependencyKind.Completed);
                }

                context.RegisterDependencyRange(
                    field.GetDirectives().Select(t => t.TypeReference),
                    TypeDependencyKind.Completed);
            }
        }
Ejemplo n.º 6
0
        private static void RegisterFieldDependencies(
            this ITypeDiscoveryContext context,
            IReadOnlyList <OutputFieldDefinitionBase> fields)
        {
            foreach (OutputFieldDefinitionBase field in fields)
            {
                RegisterAdditionalDependencies(context, field);

                if (field.Type is not null)
                {
                    context.RegisterDependency(field.Type,
                                               TypeDependencyKind.Default);
                }

                context.RegisterDependencyRange(
                    field.GetDirectives().Select(t => t.TypeReference),
                    TypeDependencyKind.Completed);
            }

            RegisterFieldDependencies(context,
                                      fields.SelectMany(t => t.GetArguments()));
        }
Ejemplo n.º 7
0
        private static void RegisterFieldDependencies(
            this ITypeDiscoveryContext context,
            IEnumerable <OutputFieldDefinitionBase> fields)
        {
            foreach (OutputFieldDefinitionBase field in fields)
            {
                RegisterAdditionalDependencies(context, field);

                if (field.Type != null)
                {
                    context.RegisterDependency(field.Type,
                                               TypeDependencyKind.Default);
                }

                context.RegisterDependencyRange(
                    field.Directives.Select(t => t.TypeReference),
                    TypeDependencyKind.Completed);

                RegisterFieldDependencies(context,
                                          fields.SelectMany(t => t.Arguments).ToList());
            }
        }