Neo4j
Description
Neo4j can be used as the backing implementation for Flex graph operations. Your application code should depend on IFlexGraphStore, while Flex provides the Neo4j implementation and wiring.
Important concepts
IFlexGraphStoreis the contract: your app uses a shared graph abstraction rather than Neo4j driver APIs.Nodes are models: graph operations typically read/write node models (domain models) through the store.
Generated flow: generated handlers/queries use
cmd.Dto.GetAppContext()/params.GetAppContext()and then callIFlexGraphStore.
Configuration in DI
Add the provider in your DI composition root (commonly in EndPoints/...CommonConfigs/OtherApplicationServicesConfig.cs).
public static class OtherApplicationServicesConfig
{
public static IServiceCollection AddOtherApplicationServices(
this IServiceCollection services,
IConfiguration configuration)
{
// Registers Neo4j as the IFlexGraphStore bridge.
// Flex auto-wires generated Queries/Handlers that use IFlexGraphStore.
services.AddFlexNeo4jGraphStore(configuration);
return services;
}
}appsettings.json
Configuration is read from FlexBase:DataStores:Graph:Neo4j.
Examples (template-based)
These examples mirror the generated Query and PostBusHandler templates. You do not register these types manually—Flex discovers and wires generated Queries/Handlers automatically.
Create node (PostBusHandler)
Get node by ID (Query)
Library-specific considerations
Secrets: store Neo4j passwords in a secret manager and inject via configuration.
Connection URI: use
bolt+s://(or your cluster’s required scheme) when connecting over TLS.
Last updated