# AspireAzureEFPostgreSqlExtensions

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

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

## Definition

```csharp
namespace Microsoft.Extensions.Hosting;

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

## Methods

- [AddAzureNpgsqlDbContext(IHostApplicationBuilder, string, Action<AzureNpgsqlEntityFrameworkCorePostgreSQLSettings>, Action<DbContextOptionsBuilder>)](/reference/api/csharp/aspire.azure.npgsql.entityframeworkcore.postgresql/aspireazureefpostgresqlextensions/methods.md#addazurenpgsqldbcontext-ihostapplicationbuilder-string-action-azurenpgsqlentityframeworkcorepostgresqlsettings-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.
- [EnrichAzureNpgsqlDbContext(IHostApplicationBuilder, Action<AzureNpgsqlEntityFrameworkCorePostgreSQLSettings>)](/reference/api/csharp/aspire.azure.npgsql.entityframeworkcore.postgresql/aspireazureefpostgresqlextensions/methods.md#enrichazurenpgsqldbcontext-ihostapplicationbuilder-action-azurenpgsqlentityframeworkcorepostgresqlsettings) `extension` -- Configures retries, health check, logging and telemetry for the `EntityFrameworkCore.DbContext`.
