Ejemplo n.º 1
0
        public StarWarsSchema(IServiceProvider provider)
            : base(provider)
        {
            Query    = (StarWarsQuery)provider.GetService(typeof(StarWarsQuery)) ?? throw new InvalidOperationException();
            Mutation = (StarWarsMutation)provider.GetService(typeof(StarWarsMutation)) ?? throw new InvalidOperationException();

            FieldMiddleware.Use(new InstrumentFieldsMiddleware());
        }
Ejemplo n.º 2
0
        public OpenBrewerySchema(IServiceProvider serviceProvider)
            : base(serviceProvider)
        {
            Query = serviceProvider.GetRequiredService <OpenBreweryQuery>();

            var middlewares = serviceProvider
                              .GetRequiredService <IEnumerable <IFieldMiddleware> >();

            foreach (var middleware in middlewares)
            {
                _ = FieldMiddleware.Use(middleware);
            }
        }
Ejemplo n.º 3
0
    private void Build()
    {
        Query    = _serviceProvider.GetRequiredService <QueryObject>();
        Mutation = _serviceProvider.GetRequiredService <MutationObject>();

        FieldMiddleware.Use(_serviceProvider.GetRequiredService <InstrumentFieldsMiddleware>());

        RegisterType(_serviceProvider.GetRequiredService <FileHandleRefType>());
        RegisterType(_serviceProvider.GetRequiredService <FileInterface>());
        RegisterType(_serviceProvider.GetRequiredService <RegularFileType>());
        RegisterType(_serviceProvider.GetRequiredService <UnknownFileType>());
        RegisterType(_serviceProvider.GetRequiredService <DirectoryType>());
        RegisterType(_serviceProvider.GetRequiredService <FileStatsType>());
        RegisterType(_serviceProvider.GetRequiredService <DirentType>());

        RegisterType(_serviceProvider.GetRequiredService <FileHandleGraphType>());

        RegisterType(_serviceProvider.GetRequiredService <JsonGraphType>());
        RegisterType(_serviceProvider.GetRequiredService <UrlGraphType>());
    }