public static void RegisterDataLoader(
            this ISchemaConfiguration configuration, Type type)

        {
            throw new NotSupportedException(
                      "This method is no longer supported.");
        }
Exemplo n.º 2
0
        public static Schema GetSchema(this ISchemaConfiguration schemaConfiguration, ICustomPropertyConfigurationProvider customPropertyConfigurationProvider)
        {
            var description = schemaConfiguration.Description;

            if (description.CountLimit == 0)
            {
                description.CountLimit = 1000;
            }

            if (description.CountLimitForSuperUser == 0)
            {
                description.CountLimitForSuperUser = description.CountLimit;
            }

            if (description.DownloadLimit == 0)
            {
                description.DownloadLimit = 10000;
            }

            if (description.DownloadLimitForSuperUser == 0)
            {
                description.DownloadLimitForSuperUser = description.DownloadLimit;
            }

            return(new Schema
            {
                Description = description,
                Types = schemaConfiguration.Types,
                ConnectorsFactory = schemaConfiguration.ConnectorsFactory,
                CustomPropertyConfigurationProvider = customPropertyConfigurationProvider,
                PropertyDescriptionBuilder = schemaConfiguration.PropertyDescriptionBuilder,
            });
        }
 /// <summary>
 /// Merges the specified schema configuration into this configuration as allowed by this instance.
 /// </summary>
 /// <param name="schemaConfig">The schema configuration.</param>
 public void Merge(ISchemaConfiguration schemaConfig)
 {
     _declarationOptions.Merge(schemaConfig.DeclarationOptions);
     _executionOptions.Merge(schemaConfig.ExecutionOptions);
     _responseOptions.Merge(schemaConfig.ResponseOptions);
     _cacheOptions.Merge(schemaConfig.QueryCacheOptions);
 }
 public static ISchemaConfiguration Use <TMiddleware>(
     this ISchemaConfiguration configuration)
     where TMiddleware : class
 {
     return(configuration.Use(
                FieldClassMiddlewareFactory.Create <TMiddleware>()));
 }
Exemplo n.º 5
0
 public SqlReflection(OracleConnectionProvider provider, ISchemaConfiguration schemaConfiguration)
 {
     _provider  = provider;
     _schema    = schemaConfiguration.Schema;
     _buildData = new Task(BuildData);
     _buildData.Start();
 }
Exemplo n.º 6
0
 public static void RegisterDataLoader <TLoader>(
     this ISchemaConfiguration configuration)
     where TLoader : class, IDispatchableDataLoader
 {
     RegisterDataLoader <TLoader>(configuration,
                                  typeof(TLoader).FullName, ExecutionScope.Request);
 }
Exemplo n.º 7
0
        public static void RegisterDataLoader(
            this ISchemaConfiguration configuration, Type type)

        {
            RegisterDataLoader(configuration, type,
                               type.FullName, ExecutionScope.Request);
        }
 public static void RegisterDataLoader <TLoader>(
     this ISchemaConfiguration configuration)
     where TLoader : class, IDataLoader
 {
     throw new NotSupportedException(
               "This method is no longer supported.");
 }
Exemplo n.º 9
0
 public static void RegisterDirective(
     this ISchemaConfiguration context,
     string name,
     DirectiveLocation location,
     Func <IDirectiveTypeDescriptor, IDirectiveTypeDescriptor> configure) =>
 context.RegisterDirective(new DirectiveType(x =>
                                             configure(x.Name(name).Location(location))));
 public static void RegisterDataLoader <TLoader>(
     this ISchemaConfiguration configuration,
     Func <IServiceProvider, TLoader> loaderFactory)
     where TLoader : IDataLoader
 {
     throw new NotSupportedException(
               "This method is no longer supported.");
 }
 public static ISchemaConfiguration Use <TMiddleware>(
     this ISchemaConfiguration configuration,
     Func <IServiceProvider, FieldDelegate, TMiddleware> factory)
     where TMiddleware : class
 {
     return(configuration.Use(
                FieldClassMiddlewareFactory.Create(factory)));
 }
 public static void RegisterDataLoader(
     this ISchemaConfiguration configuration,
     Type type,
     ExecutionScope scope,
     Func <IServiceProvider, IDataLoader> loaderFactory)
 {
     throw new NotSupportedException(
               "This method is no longer supported.");
 }
Exemplo n.º 13
0
        public static void RegisterDataLoader(
            this ISchemaConfiguration configuration,
            Type type,
            Func <IServiceProvider, IDispatchableDataLoader> loaderFactory)

        {
            RegisterDataLoader(configuration, type, type.FullName,
                               ExecutionScope.Request, loaderFactory);
        }
Exemplo n.º 14
0
 public static void RegisterDataLoader <TLoader>(
     this ISchemaConfiguration configuration,
     string key,
     ExecutionScope scope)
     where TLoader : class, IDispatchableDataLoader
 {
     configuration.RegisterDataLoader <TLoader>(key, scope,
                                                triggerLoaderAsync: (d, c) => d.DispatchAsync());
 }
Exemplo n.º 15
0
 public static void RegisterDataLoader <TLoader>(
     this ISchemaConfiguration configuration,
     Func <IServiceProvider, TLoader> loaderFactory)
     where TLoader : IDispatchableDataLoader
 {
     RegisterDataLoader <TLoader>(
         configuration, typeof(TLoader).FullName,
         ExecutionScope.Request, loaderFactory);
 }
Exemplo n.º 16
0
 public static void RegisterDataLoader <TLoader>(
     this ISchemaConfiguration configuration,
     string key,
     ExecutionScope scope,
     Func <IServiceProvider, TLoader> loaderFactory)
     where TLoader : IDispatchableDataLoader
 {
     configuration.RegisterDataLoader <TLoader>(
         key, scope, loaderFactory, (d, c) => d.DispatchAsync());
 }
 public static ISchemaConfiguration Map(
     this ISchemaConfiguration configuration,
     FieldReference fieldReference,
     FieldMiddleware middleware)
 {
     return(configuration.Use(
                FieldClassMiddlewareFactory.Create(
                    (s, n) => new MapMiddleware(
                        n, fieldReference, middleware(n)))));
 }
        public static ISchemaConfiguration UseGlobalObjectIdentifier(
            this ISchemaConfiguration configuration)
        {
            if (configuration is null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            return(configuration.Use <IdMiddleware>());
        }
Exemplo n.º 19
0
        public static IBindType <T> BindType <T>(
            this ISchemaConfiguration schemaConfiguration)
            where T : class
        {
            if (schemaConfiguration == null)
            {
                throw new ArgumentNullException(nameof(schemaConfiguration));
            }

            return(schemaConfiguration.BindType <T>(BindingBehavior.Implicit));
        }
Exemplo n.º 20
0
        public static void RegisterDataLoader(
            this ISchemaConfiguration configuration,
            Type type,
            string key,
            ExecutionScope scope)

        {
            configuration.RegisterDataLoader(type, key, scope,
                                             triggerLoaderAsync: (d, c) => ((IDispatchableDataLoader)d)
                                             .DispatchAsync());
        }
Exemplo n.º 21
0
        public static void RegisterDataLoader(
            this ISchemaConfiguration configuration,
            Type type,
            string key,
            ExecutionScope scope,
            Func <IServiceProvider, IDispatchableDataLoader> loaderFactory)

        {
            configuration.RegisterDataLoader(type, key, scope, loaderFactory,
                                             (d, c) => ((IDispatchableDataLoader)d).DispatchAsync());
        }
Exemplo n.º 22
0
        public static IBindResolverDelegate BindResolver(
            this ISchemaConfiguration schemaConfiguration,
            Func <Task <object> > resolver)
        {
            if (resolver == null)
            {
                throw new ArgumentNullException(nameof(resolver));
            }

            return(schemaConfiguration.BindResolver((ctx, ct) => resolver()));
        }
        public static void ConfigureSchema(ISchemaConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new System.ArgumentNullException(nameof(configuration));
            }

            configuration.RegisterQueryType <QueryType>();
            configuration.RegisterMutationType <MutationType>();
            configuration.UseGlobalObjectIdentifier();
        }
Exemplo n.º 24
0
 public static void RegisterTypeByInterface<T>(this ISchemaConfiguration c, Assembly[] assemblies,
     ServiceLifetime lifetime = ServiceLifetime.Transient)
 {
     var typesFromAssemblies = assemblies.SelectMany(a => a.DefinedTypes.Where(x => x.GetInterfaces().Contains(typeof(T))));
     foreach (var type in typesFromAssemblies)
     {
         var registerTypeInfo = typeof(ICodeFirstConfiguration).GetMethods()
             .First(m => m.IsGenericMethod && m.Name == "RegisterType");
         registerTypeInfo.MakeGenericMethod(type.AsType()).Invoke(c, new object[]{});
     }
 }
Exemplo n.º 25
0
        public static ISchemaConfiguration UseNullResolver(
            this ISchemaConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            configuration.Use(next => context => Task.CompletedTask);
            return(configuration);
        }
Exemplo n.º 26
0
        public static IBindResolver <TResolver> BindResolver <TResolver>(
            this ISchemaConfiguration schemaConfiguration)
            where TResolver : class
        {
            if (schemaConfiguration is null)
            {
                throw new ArgumentNullException(nameof(schemaConfiguration));
            }

            return(schemaConfiguration.BindResolver <TResolver>(
                       BindingBehavior.Implicit));
        }
Exemplo n.º 27
0
        public static IBindResolverDelegate BindResolver(
            this ISchemaConfiguration schemaConfiguration,
            Func <IResolverContext, object> resolver)
        {
            if (schemaConfiguration == null)
            {
                throw new ArgumentNullException(nameof(schemaConfiguration));
            }

            return(schemaConfiguration.BindResolver(
                       ctx => Task.FromResult(resolver(ctx))));
        }
Exemplo n.º 28
0
        private void ConfigureSchema(ISchemaConfiguration schema)
        {
            if (_environment.IsDevelopment())
            {
                schema.Options.StrictValidation = false;
            }

            schema.BindType <CreditCard>();

            schema.BindResolver <QueryResolver>()
            .To("Query")
            .Resolve("cards")
            .With(t => t.GetAllCardsAsync(default))
Exemplo n.º 29
0
        public static ISchemaConfiguration RegisterObjectTypes(this ISchemaConfiguration schemaConfiguration, Assembly graphTypeAssembly)
        {
            var objectTypes = graphTypeAssembly
                              .GetTypes()
                              .Where(type => typeof(ObjectType).IsAssignableFrom(type));

            foreach (var objectType in objectTypes)
            {
                schemaConfiguration.RegisterType(objectType);
            }

            return(schemaConfiguration);
        }
Exemplo n.º 30
0
        public static void ConfigureSchema(ISchemaConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new System.ArgumentNullException(nameof(configuration));
            }

            configuration.RegisterQueryType <QueryType>();
            configuration.RegisterType <LifeInsuranceContractType>();
            configuration.RegisterType <SomeOtherContractType>();
            configuration.RegisterDirective <CustomDirectiveType>();

            configuration.UseGlobalObjectIdentifier();
        }
Exemplo n.º 31
0
 public SqlDBProvider(ISchemaConfiguration SchemaConfiguration)
 {
     this._db = new SqlConnection(SchemaConfiguration.GetConnectionString());
 }
Exemplo n.º 32
0
 public OmletSchemaProvider(IRootPathProvider rootProvider, ISchemaConfiguration configuration)
 {
     this.rootProvider = rootProvider;
     this.configuration = configuration;
     this.cache = new OmletSchemaCache(ResolveSchema);
 }