Ejemplo n.º 1
0
        protected override void OnRegisterDependencies(
            IInitializationContext context,
            ObjectTypeDefinition definition)
        {
            base.OnRegisterDependencies(context, definition);

            context.RegisterDependency(new ClrTypeReference(
                                           typeof(T), TypeContext.Output),
                                       TypeDependencyKind.Named);
            context.RegisterDependency(new ClrTypeReference(
                                           typeof(EdgeType <T>), TypeContext.Output),
                                       TypeDependencyKind.Default);
        }
Ejemplo n.º 2
0
        public static void RegisterDependencies(
            this IInitializationContext context,
            InputObjectTypeDefinition definition)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

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

            RegisterDirectiveDependencies(context, definition);

            foreach (InputFieldDefinition field in definition.Fields)
            {
                if (field.Type != null)
                {
                    context.RegisterDependency(field.Type,
                                               TypeDependencyKind.Default);
                }

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

            context.RegisterDependency(
                ClrTypeReference.FromSchemaType <EdgeType <T> >(),
                TypeDependencyKind.Default);
        }
Ejemplo n.º 4
0
        private static void RegisterFieldDependencies(
            this IInitializationContext context,
            IEnumerable <ArgumentDefinition> fields)
        {
            foreach (ArgumentDefinition field in fields)
            {
                if (field.Type != null)
                {
                    context.RegisterDependency(field.Type,
                                               TypeDependencyKind.Completed);
                }

                context.RegisterDependencyRange(
                    field.Directives.Select(t => t.TypeReference),
                    TypeDependencyKind.Completed);
            }
        }
Ejemplo n.º 5
0
        private static void RegisterFieldDependencies(
            this IInitializationContext context,
            IEnumerable <OutputFieldDefinitionBase> fields)
        {
            foreach (OutputFieldDefinitionBase field in fields)
            {
                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());
            }
        }