# AspireAzureEFCoreCosmosExtensions

- Kind: `class`
- Package: [Aspire.Microsoft.EntityFrameworkCore.Cosmos](/reference/api/csharp/aspire.microsoft.entityframeworkcore.cosmos.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.Microsoft.EntityFrameworkCore.Cosmos/AspireAzureEFCoreCosmosExtensions.cs)

Extension methods for configuring EntityFrameworkCore DbContext to Azure Cosmos DB

## Definition

```csharp
namespace Microsoft.Extensions.Hosting;

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

## Methods

- [AddCosmosDbContext(IHostApplicationBuilder, string, Action<EntityFrameworkCoreCosmosSettings>, Action<DbContextOptionsBuilder>)](/reference/api/csharp/aspire.microsoft.entityframeworkcore.cosmos/aspireazureefcorecosmosextensions/methods.md#addcosmosdbcontext-ihostapplicationbuilder-string-action-entityframeworkcorecosmossettings-action-dbcontextoptionsbuilder) `extension` -- Registers the given `EntityFrameworkCore.DbContext` as a service in the services provided by the `builder`. Derives the name of the database from the connection string.
- [AddCosmosDbContext(IHostApplicationBuilder, string, string, Action<EntityFrameworkCoreCosmosSettings>, Action<DbContextOptionsBuilder>)](/reference/api/csharp/aspire.microsoft.entityframeworkcore.cosmos/aspireazureefcorecosmosextensions/methods.md#addcosmosdbcontext-ihostapplicationbuilder-string-string-action-entityframeworkcorecosmossettings-action-dbcontextoptionsbuilder) `extension` -- Registers the given `EntityFrameworkCore.DbContext` as a service in the services provided by the `builder`. Enables db context pooling, logging and telemetry.
- [EnrichCosmosDbContext(IHostApplicationBuilder, Action<EntityFrameworkCoreCosmosSettings>)](/reference/api/csharp/aspire.microsoft.entityframeworkcore.cosmos/aspireazureefcorecosmosextensions/methods.md#enrichcosmosdbcontext-ihostapplicationbuilder-action-entityframeworkcorecosmossettings) `extension` -- Configures logging and telemetry for the `EntityFrameworkCore.DbContext`.
