using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using StellaOps.Graph.Indexer.Analytics;
using StellaOps.Graph.Indexer.Incremental;
using StellaOps.Graph.Indexer.Ingestion.Sbom;
using StellaOps.Graph.Indexer.Persistence.Postgres;
using StellaOps.Graph.Indexer.Persistence.Postgres.Repositories;
using StellaOps.Infrastructure.Postgres.Options;
namespace StellaOps.Graph.Indexer.Persistence.Extensions;
///
/// Extension methods for configuring Graph.Indexer persistence services.
///
public static class GraphIndexerPersistenceExtensions
{
///
/// Adds Graph.Indexer PostgreSQL persistence services.
///
public static IServiceCollection AddGraphIndexerPersistence(
this IServiceCollection services,
IConfiguration configuration,
string sectionName = "Postgres:Graph")
{
services.Configure(configuration.GetSection(sectionName));
services.AddSingleton();
// Register repositories
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
return services;
}
///
/// Adds Graph.Indexer PostgreSQL persistence services with explicit options.
///
public static IServiceCollection AddGraphIndexerPersistence(
this IServiceCollection services,
Action configureOptions)
{
services.Configure(configureOptions);
services.AddSingleton();
// Register repositories
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
return services;
}
}