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)); }
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)); }
public static GremlinqSetup UseGremlinServer <TVertex, TEdge>(this GremlinqSetup setup) { return(setup .UseGremlinServer() .UseModel(GraphModel .FromBaseTypes <TVertex, TEdge>(lookup => lookup .IncludeAssembliesOfBaseTypes()))); }
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 UseJanusGraph <TVertex, TEdge>(this GremlinqSetup setup, Action <ProviderSetup <IJanusGraphConfigurator> >?extraSetupAction = null) { return(setup .UseJanusGraph(extraSetupAction) .ConfigureEnvironment(env => env .UseModel(GraphModel .FromBaseTypes <TVertex, TEdge>(lookup => lookup .IncludeAssembliesOfBaseTypes())))); }
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)); }
public static GremlinqSetup UseCosmosDb <TVertex, TEdge>(this GremlinqSetup setup, Expression <Func <TVertex, object> > partitionKeyExpression) { return(setup .UseCosmosDb() .UseModel(GraphModel .FromBaseTypes <TVertex, TEdge>(lookup => lookup .IncludeAssembliesOfBaseTypes()) .ConfigureProperties(model => model .ConfigureElement <TVertex>(conf => conf .IgnoreOnUpdate(partitionKeyExpression))))); }
public static GremlinqSetup UseCosmosDb <TVertex, TEdge>(this GremlinqSetup setup, Expression <Func <TVertex, object> > partitionKeyExpression, Action <ProviderSetup <ICosmosDbConfigurator> >?extraSetupAction = null) { return(setup .UseCosmosDb(extraSetupAction) .ConfigureEnvironment(env => env .UseModel(GraphModel .FromBaseTypes <TVertex, TEdge>(lookup => lookup .IncludeAssembliesOfBaseTypes()) .ConfigureProperties(model => model .ConfigureElement <TVertex>(conf => conf .IgnoreOnUpdate(partitionKeyExpression)))))); }
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> >())); }
public static GremlinqSetup RegisterTypes(this GremlinqSetup setup, Action <IServiceCollection> registration) { registration(setup.ServiceCollection); return(setup); }
public static GremlinqSetup ConfigureEnvironment(this GremlinqSetup setup, Func <IGremlinQueryEnvironment, IGremlinQueryEnvironment> environmentTransformation) { return(setup.RegisterTypes(serviceCollection => serviceCollection .AddSingleton <IGremlinQueryEnvironmentTransformation>(new EnvironmentTransformation(environmentTransformation)))); }
public static GremlinqSetup UseConfigurationSection(this GremlinqSetup setup, string sectionName) { return(setup.RegisterTypes(serviceCollection => serviceCollection .AddSingleton(new GremlinqSetupInfo(sectionName)))); }
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>())); }
public static GremlinqSetup UseNeptune(this GremlinqSetup setup) { return(setup .UseWebSocket() .RegisterTypes(serviceCollection => serviceCollection.AddSingleton <IGremlinQueryEnvironmentTransformation, UseNeptuneGremlinQueryEnvironmentTransformation>())); }
public static GremlinqSetup ConfigureQuerySource(this GremlinqSetup setup, Func <IGremlinQuerySource, IGremlinQuerySource> sourceTranformation) { return(setup.RegisterTypes(serviceCollection => serviceCollection .AddSingleton <IGremlinQuerySourceTransformation>(new SourceTransformation(sourceTranformation)))); }
public static GremlinqSetup UseJanusGraph(this GremlinqSetup setup) { return(new GremlinqSetup(setup.ServiceCollection.AddSingleton <IGremlinQueryEnvironmentTransformation, UseJanusGraphGremlinQueryEnvironmentTransformation>())); }