How to create a graph provider

For full customization and best performance you should create your own Associativy instance, containing one or more graph providers. For this to work in the standard (but not only) way, an Associativy instance module should...

  • Define an INodeToNodeConnector implementation, i.e. a record type to store connections
  • Define an implementation of IGraphProvider (the graph provider itself)
  • Implement the appropriate migrations to set up node types and connector records; nodes should have CommonPart attached
  • Optionally add AssociativyNodeLabelPart to node content types, if the nodes should be searchable by label. The default implementation generates a label from the title, using token configuration. On how to use this, see "How to create and maintain graphs using only the admin UI".

The above are not necessary if a module just wants to use Associativy services with an existing graph provider; these are only needed for a completely new and independent graph.

By convention modules using Associativy are named Associativy.Instances.ModuleName, but this is not mandatory.

Examples from Associativy Notions

Connector record

    public class NotionToNotionConnectorRecord : NodeToNodeConnectorRecord

Graph provider

    public class NotionsGraphProvider : IGraphProvider
        private readonly Func<IPathServices> _pathServicesFactory;

        public Localizer T { get; set; }

        // Notice the lazy-loading of path services
        public NotionsGraphProvider(
            Work<ISqlConnectionManager<NotionToNotionConnectorRecord>> connectionManagerWork, 
            Work<IStandardPathFinder> pathFinderWork)
            _pathServicesFactory = () => new PathServices(connectionManagerWork.Value, pathFinderWork.Value);

            T = NullLocalizer.Instance;

        public void Describe(DescribeContext describeContext)
                T("Associativy Notions"),
                new[] { "Notion" },

Migrations for the connector record

    public class Migrations : DataMigrationImpl
        public int Create()

            return 1;

Browsing through the Associativy Notions demo project's code is a good start.