# AspireEFPostgreSqlExtensions

- Kind: `class`
- Package: [Aspire.Npgsql.EntityFrameworkCore.PostgreSQL](/reference/api/csharp/aspire.npgsql.entityframeworkcore.postgresql.md)
- Version: `13.4.0`
- Namespace: `Microsoft.Extensions.Hosting`
- Target framework: `net10.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Components/Aspire.Npgsql.EntityFrameworkCore.PostgreSQL/AspireEFPostgreSqlExtensions.cs)

Provides extension methods for registering a PostgreSQL database context in an Aspire application.

## Definition

```csharp
namespace Microsoft.Extensions.Hosting;

public static class AspireEFPostgreSqlExtensions
{
    // ...
}
```

## Methods

- [AddNpgsqlDbContext(IHostApplicationBuilder, string, Action<NpgsqlEntityFrameworkCorePostgreSQLSettings>, Action<DbContextOptionsBuilder>)](/reference/api/csharp/aspire.npgsql.entityframeworkcore.postgresql/aspireefpostgresqlextensions/methods.md#addnpgsqldbcontext-ihostapplicationbuilder-string-action-npgsqlentityframeworkcorepostgresqlsettings-action-dbcontextoptionsbuilder) `extension` -- Registers the given `EntityFrameworkCore.DbContext` as a service in the services provided by the `builder`. Enables db context pooling, retries, corresponding health check, logging and telemetry.
- [EnrichNpgsqlDbContext(IHostApplicationBuilder, Action<NpgsqlEntityFrameworkCorePostgreSQLSettings>)](/reference/api/csharp/aspire.npgsql.entityframeworkcore.postgresql/aspireefpostgresqlextensions/methods.md#enrichnpgsqldbcontext-ihostapplicationbuilder-action-npgsqlentityframeworkcorepostgresqlsettings) `extension` -- Configures retries, health check, logging and telemetry for the `EntityFrameworkCore.DbContext`.
