예제 #1
0
        public static void RegisterDependencies(
            this IInitializationContext context,
            ObjectTypeDefinition definition)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

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

            context.RegisterDependencyRange(
                definition.Interfaces,
                TypeDependencyKind.Default);

            RegisterDirectiveDependencies(context, definition);
            RegisterFieldDependencies(context, definition.Fields);

            foreach (ObjectFieldDefinition field in definition.Fields)
            {
                if (field.Member != null)
                {
                    context.RegisterResolver(
                        field.Name,
                        field.Member,
                        definition.ClrType,
                        field.ResolverType);
                }
            }
        }
예제 #2
0
        protected override void OnRegisterDependencies(
            IInitializationContext context,
            ObjectTypeDefinition definition)
        {
            base.OnRegisterDependencies(context, definition);

            RegisterDependencies(context, definition);

            foreach (ObjectFieldDefinition field in definition.Fields)
            {
                if (field.Member != null)
                {
                    context.RegisterResolver(
                        field.Name,
                        field.Member,
                        definition.ClrType,
                        field.ResolverType);
                }
            }
        }