# AspireEFMySqlExtensions

- Kind: `class`
- Package: [Aspire.Pomelo.EntityFrameworkCore.MySql](/reference/api/csharp/aspire.pomelo.entityframeworkcore.mysql.md)
- Version: `13.4.0`
- Namespace: `Microsoft.Extensions.Hosting`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Components/Aspire.Pomelo.EntityFrameworkCore.MySql/AspireEFMySqlExtensions.cs)

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

## Definition

```csharp
namespace Microsoft.Extensions.Hosting;

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

## Methods

- [AddMySqlDbContext(IHostApplicationBuilder, string, Action<PomeloEntityFrameworkCoreMySqlSettings>, Action<DbContextOptionsBuilder>)](/reference/api/csharp/aspire.pomelo.entityframeworkcore.mysql/aspireefmysqlextensions/methods.md#addmysqldbcontext-ihostapplicationbuilder-string-action-pomeloentityframeworkcoremysqlsettings-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.
- [EnrichMySqlDbContext(IHostApplicationBuilder, Action<PomeloEntityFrameworkCoreMySqlSettings>)](/reference/api/csharp/aspire.pomelo.entityframeworkcore.mysql/aspireefmysqlextensions/methods.md#enrichmysqldbcontext-ihostapplicationbuilder-action-pomeloentityframeworkcoremysqlsettings) `extension` -- Configures retries, health check, logging and telemetry for the `EntityFrameworkCore.DbContext`.
