Пример #1
0
        public static GremlinqSetup UseCosmosDb(this GremlinqSetup setup, Action <ProviderSetup <ICosmosDbConfigurator> >?extraSetupAction = null)
        {
            return(setup
                   .UseProvider(
                       "CosmosDb",
                       (source, configuratorTransformation) => source
                       .UseCosmosDb(configuratorTransformation),
                       setup => setup
                       .ConfigureWebSocket()
                       .Configure((configurator, providerSection) =>
            {
                if (providerSection["Database"] is { } databaseName)
                {
                    configurator = configurator.OnDatabase(databaseName);
                }

                if (providerSection["Graph"] is { } graphName)
                {
                    configurator = configurator.OnGraph(graphName);
                }

                if (providerSection["AuthKey"] is { } authKey)
                {
                    configurator = configurator.AuthenticateBy(authKey);
                }

                return configurator;
            }),
                       extraSetupAction));
        }
Пример #2
0
        public static GremlinqSetup UseNeptune(this GremlinqSetup setup, Action <ProviderSetup <INeptuneConfigurator> >?extraSetupAction = null)
        {
            return(setup
                   .UseProvider(
                       "Neptune",
                       (source, configuratorTransformation) => source
                       .UseNeptune(configuratorTransformation),
                       setup => setup
                       .ConfigureWebSocket()
                       .Configure((configurator, providerSection) =>
            {
                if (providerSection.GetSection("ElasticSearch") is { } elasticSearchSection)
                {
                    if (bool.TryParse(elasticSearchSection["Enabled"], out var isEnabled) && isEnabled)
                    {
                        if (elasticSearchSection["EndPoint"] is { } endPoint&& Uri.TryCreate(endPoint, UriKind.Absolute, out var uri))
                        {
                            var indexConfiguration = Enum.TryParse <NeptuneElasticSearchIndexConfiguration>(elasticSearchSection["IndexConfiguration"], true, out var outVar)
                                            ? outVar
                                            : NeptuneElasticSearchIndexConfiguration.Standard;

                            configurator = configurator
                                           .UseElasticSearch(uri, indexConfiguration);
                        }
                    }
                }

                return configurator;
            }),
                       extraSetupAction));
        }
Пример #3
0
 public static GremlinqSetup UseJanusGraph(this GremlinqSetup setup, Action <ProviderSetup <IJanusGraphConfigurator> >?extraSetupAction = null)
 {
     return(setup
            .UseProvider(
                "JanusGraph",
                (source, configuratorTransformation) => source
                .UseJanusGraph(configuratorTransformation),
                setup => setup
                .ConfigureWebSocket(),
                extraSetupAction));
 }