Table of Contents

Method AddInfrastructure

Namespace
MailFathom.Infrastructure
Assembly
MailFathom.Infrastructure.dll

AddInfrastructure(IServiceCollection, Func<IServiceProvider, PostgresConnectionSettings>, PostgresTextSearchConfiguration)

Registers EF Core persistence, MailKit mailbox access, and application synchronization services.

public static IServiceCollection AddInfrastructure(this IServiceCollection services, Func<IServiceProvider, PostgresConnectionSettings> currentConnectionSettings, PostgresTextSearchConfiguration textSearchConfiguration)

Parameters

services IServiceCollection

The service collection.

currentConnectionSettings Func<IServiceProvider, PostgresConnectionSettings>

Supplies where the PostgreSQL connection string and its password currently come from.

textSearchConfiguration PostgresTextSearchConfiguration

The validated PostgreSQL text search configuration the lexical index is built with.

Returns

IServiceCollection

The service collection, for chaining.

Remarks

The settings arrive already read rather than as an IConfiguration this method reaches into, so which key holds them stays a host decision and this assembly gains no configuration dependency. They arrive as an accessor rather than as a value because a secret reference can be repointed by a configuration reload, and a value captured at registration would keep authenticating with the reference the operator replaced.

The embedding stores registered here are the tables; the units of work that write vectors into them are not, and belong to AddEmailEmbeddingGeneration(IServiceCollection) for the reason that method states. A registration added here that resolves an ITextEmbeddingGenerator belongs there instead.

Exceptions

ArgumentNullException

Thrown when any argument is null.