Esempio n. 1
0
 public static GremlinqSetup UseConfigurationSection(this GremlinqSetup setup, string sectionName)
 {
     return(setup.RegisterTypes(serviceCollection => serviceCollection
                                .AddSingleton <IGremlinqConfiguration>(serviceProvider => new GremlinqConfiguration(serviceProvider
                                                                                                                    .GetServiceOrThrow <IConfiguration>()
                                                                                                                    .GetSection(sectionName)
                                                                                                                    .GetSection("Gremlinq")))));
 }
        public static GremlinqSetup UseProvider <TConfigurator>(
            this GremlinqSetup setup,
            string sectionName,
            Func <IConfigurableGremlinQuerySource, Func <TConfigurator, IGremlinQuerySourceTransformation>, IGremlinQuerySource> providerChoice,
            Action <ProviderSetup <TConfigurator> > setupAction,
            Action <ProviderSetup <TConfigurator> >?extraSetupAction) where TConfigurator : IProviderConfigurator <TConfigurator>
        {
            setupAction(new ProviderSetup <TConfigurator>(setup.ServiceCollection));

            if (extraSetupAction is { } extraConfiguration)
            {
                extraConfiguration(new ProviderSetup <TConfigurator>(setup.ServiceCollection));
            }

            return(setup.RegisterTypes(serviceCollection => serviceCollection
                                       .AddSingleton(new ProviderSetupInfo <TConfigurator>(sectionName, providerChoice))
                                       .AddSingleton <IGremlinQuerySourceTransformation, UseProviderGremlinQuerySourceTransformation <TConfigurator> >()
                                       .AddSingleton <IProviderConfigurationSection, ProviderConfigurationSection <TConfigurator> >()));
        }
Esempio n. 3
0
 public static GremlinqSetup ConfigureEnvironment(this GremlinqSetup setup, Func <IGremlinQueryEnvironment, IGremlinQueryEnvironment> environmentTransformation)
 {
     return(setup.RegisterTypes(serviceCollection => serviceCollection
                                .AddSingleton <IGremlinQueryEnvironmentTransformation>(new EnvironmentTransformation(environmentTransformation))));
 }
Esempio n. 4
0
 public static GremlinqSetup UseModel(this GremlinqSetup setup, IGraphModel model)
 {
     return(setup.RegisterTypes(serviceCollection => serviceCollection
                                .AddSingleton(model)
                                .AddSingleton <IGremlinQueryEnvironmentTransformation, UseModelTransformation>()));
 }
 public static GremlinqSetup ConfigureWebSocketBuilder(this GremlinqSetup setup, Func <IWebSocketGremlinQueryExecutorBuilder, IWebSocketGremlinQueryExecutorBuilder> transformation)
 {
     return(setup.RegisterTypes(serviceCollection => serviceCollection
                                .AddSingleton <IWebSocketGremlinQueryExecutorBuilderTransformation>(_ => new ConfigureWebSocketGremlinQueryExecutorBuilderTransformation(transformation))));
 }
 public static GremlinqSetup UseWebSocket(this GremlinqSetup setup)
 {
     return(setup.RegisterTypes(serviceCollection => serviceCollection
                                .AddSingleton <IGremlinQueryEnvironmentTransformation, ConfigureLoggingGremlinQueryEnvironmentTransformation>()));
 }
Esempio n. 7
0
 public static GremlinqSetup ConfigureQuerySource(this GremlinqSetup setup, Func <IGremlinQuerySource, IGremlinQuerySource> sourceTranformation)
 {
     return(setup.RegisterTypes(serviceCollection => serviceCollection
                                .AddSingleton <IGremlinQuerySourceTransformation>(new SourceTransformation(sourceTranformation))));
 }
Esempio n. 8
0
 public static GremlinqSetup UseConfigurationSection(this GremlinqSetup setup, string sectionName)
 {
     return(setup.RegisterTypes(serviceCollection => serviceCollection
                                .AddSingleton(new GremlinqSetupInfo(sectionName))));
 }