Share via


CosmosDbContextOptionsExtensions.UseCosmos Method

Definition

Overloads

UseCosmos(DbContextOptionsBuilder, String, String, Action<CosmosDbContextOptionsBuilder>)

Configures the context to connect to an Azure Cosmos database.

UseCosmos(DbContextOptionsBuilder, String, TokenCredential, String, Action<CosmosDbContextOptionsBuilder>)

Configures the context to connect to an Azure Cosmos database.

UseCosmos(DbContextOptionsBuilder, String, String, String, Action<CosmosDbContextOptionsBuilder>)

Configures the context to connect to an Azure Cosmos database.

UseCosmos<TContext>(DbContextOptionsBuilder<TContext>, String, String, Action<CosmosDbContextOptionsBuilder>)

Configures the context to connect to an Azure Cosmos database.

UseCosmos<TContext>(DbContextOptionsBuilder<TContext>, String, TokenCredential, String, Action<CosmosDbContextOptionsBuilder>)

Configures the context to connect to an Azure Cosmos database.

UseCosmos<TContext>(DbContextOptionsBuilder<TContext>, String, String, String, Action<CosmosDbContextOptionsBuilder>)

Configures the context to connect to an Azure Cosmos database.

UseCosmos(DbContextOptionsBuilder, String, String, Action<CosmosDbContextOptionsBuilder>)

Configures the context to connect to an Azure Cosmos database.

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseCosmos (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, string connectionString, string databaseName, Action<Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder> cosmosOptionsAction = default);
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseCosmos (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, string connectionString, string databaseName, Action<Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder>? cosmosOptionsAction = default);
static member UseCosmos : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder * string * string * Action<Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
<Extension()>
Public Function UseCosmos (optionsBuilder As DbContextOptionsBuilder, connectionString As String, databaseName As String, Optional cosmosOptionsAction As Action(Of CosmosDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder

Parameters

optionsBuilder
DbContextOptionsBuilder

The builder being used to configure the context.

connectionString
String

The connection string of the database to connect to.

databaseName
String

The database name.

cosmosOptionsAction
Action<CosmosDbContextOptionsBuilder>

An optional action to allow additional Cosmos-specific configuration.

Returns

The options builder so that further configuration can be chained.

Remarks

See Using DbContextOptions, and Accessing Azure Cosmos DB with EF Core for more information and examples.

Applies to

UseCosmos(DbContextOptionsBuilder, String, TokenCredential, String, Action<CosmosDbContextOptionsBuilder>)

Configures the context to connect to an Azure Cosmos database.

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseCosmos (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, string accountEndpoint, Azure.Core.TokenCredential tokenCredential, string databaseName, Action<Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder>? cosmosOptionsAction = default);
static member UseCosmos : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder * string * Azure.Core.TokenCredential * string * Action<Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
<Extension()>
Public Function UseCosmos (optionsBuilder As DbContextOptionsBuilder, accountEndpoint As String, tokenCredential As TokenCredential, databaseName As String, Optional cosmosOptionsAction As Action(Of CosmosDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder

Parameters

optionsBuilder
DbContextOptionsBuilder

The builder being used to configure the context.

accountEndpoint
String

The account end-point to connect to.

tokenCredential
TokenCredential

The Azure authentication token.

databaseName
String

The database name.

cosmosOptionsAction
Action<CosmosDbContextOptionsBuilder>

An optional action to allow additional Cosmos-specific configuration.

Returns

The options builder so that further configuration can be chained.

Remarks

See Using DbContextOptions, and Accessing Azure Cosmos DB with EF Core for more information and examples.

Applies to

UseCosmos(DbContextOptionsBuilder, String, String, String, Action<CosmosDbContextOptionsBuilder>)

Configures the context to connect to an Azure Cosmos database.

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseCosmos (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, string accountEndpoint, string accountKey, string databaseName, Action<Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder> cosmosOptionsAction = default);
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder UseCosmos (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder, string accountEndpoint, string accountKey, string databaseName, Action<Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder>? cosmosOptionsAction = default);
static member UseCosmos : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder * string * string * string * Action<Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
<Extension()>
Public Function UseCosmos (optionsBuilder As DbContextOptionsBuilder, accountEndpoint As String, accountKey As String, databaseName As String, Optional cosmosOptionsAction As Action(Of CosmosDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder

Parameters

optionsBuilder
DbContextOptionsBuilder

The builder being used to configure the context.

accountEndpoint
String

The account end-point to connect to.

accountKey
String

The account key.

databaseName
String

The database name.

cosmosOptionsAction
Action<CosmosDbContextOptionsBuilder>

An optional action to allow additional Cosmos-specific configuration.

Returns

The options builder so that further configuration can be chained.

Remarks

See Using DbContextOptions, and Accessing Azure Cosmos DB with EF Core for more information and examples.

Applies to

UseCosmos<TContext>(DbContextOptionsBuilder<TContext>, String, String, Action<CosmosDbContextOptionsBuilder>)

Configures the context to connect to an Azure Cosmos database.

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseCosmos<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, string connectionString, string databaseName, Action<Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder> cosmosOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseCosmos<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, string connectionString, string databaseName, Action<Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder>? cosmosOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
static member UseCosmos : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> * string * string * Action<Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)
<Extension()>
Public Function UseCosmos(Of TContext As DbContext) (optionsBuilder As DbContextOptionsBuilder(Of TContext), connectionString As String, databaseName As String, Optional cosmosOptionsAction As Action(Of CosmosDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder(Of TContext)

Type Parameters

TContext

The type of context to be configured.

Parameters

optionsBuilder
DbContextOptionsBuilder<TContext>

The builder being used to configure the context.

connectionString
String

The connection string of the database to connect to.

databaseName
String

The database name.

cosmosOptionsAction
Action<CosmosDbContextOptionsBuilder>

An optional action to allow additional Cosmos-specific configuration.

Returns

The options builder so that further configuration can be chained.

Remarks

See Using DbContextOptions, and Accessing Azure Cosmos DB with EF Core for more information and examples.

Applies to

UseCosmos<TContext>(DbContextOptionsBuilder<TContext>, String, TokenCredential, String, Action<CosmosDbContextOptionsBuilder>)

Configures the context to connect to an Azure Cosmos database.

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseCosmos<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, string accountEndpoint, Azure.Core.TokenCredential tokenCredential, string databaseName, Action<Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder>? cosmosOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
static member UseCosmos : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> * string * Azure.Core.TokenCredential * string * Action<Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)
<Extension()>
Public Function UseCosmos(Of TContext As DbContext) (optionsBuilder As DbContextOptionsBuilder(Of TContext), accountEndpoint As String, tokenCredential As TokenCredential, databaseName As String, Optional cosmosOptionsAction As Action(Of CosmosDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder(Of TContext)

Type Parameters

TContext

The type of context to be configured.

Parameters

optionsBuilder
DbContextOptionsBuilder<TContext>

The builder being used to configure the context.

accountEndpoint
String

The account end-point to connect to.

tokenCredential
TokenCredential

The Azure authentication token.

databaseName
String

The database name.

cosmosOptionsAction
Action<CosmosDbContextOptionsBuilder>

An optional action to allow additional Cosmos-specific configuration.

Returns

The options builder so that further configuration can be chained.

Remarks

See Using DbContextOptions, and Accessing Azure Cosmos DB with EF Core for more information and examples.

Applies to

UseCosmos<TContext>(DbContextOptionsBuilder<TContext>, String, String, String, Action<CosmosDbContextOptionsBuilder>)

Configures the context to connect to an Azure Cosmos database.

public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseCosmos<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, string accountEndpoint, string accountKey, string databaseName, Action<Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder> cosmosOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
public static Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> UseCosmos<TContext> (this Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<TContext> optionsBuilder, string accountEndpoint, string accountKey, string databaseName, Action<Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder>? cosmosOptionsAction = default) where TContext : Microsoft.EntityFrameworkCore.DbContext;
static member UseCosmos : Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> * string * string * string * Action<Microsoft.EntityFrameworkCore.Infrastructure.CosmosDbContextOptionsBuilder> -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder<'Context (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)> (requires 'Context :> Microsoft.EntityFrameworkCore.DbContext)
<Extension()>
Public Function UseCosmos(Of TContext As DbContext) (optionsBuilder As DbContextOptionsBuilder(Of TContext), accountEndpoint As String, accountKey As String, databaseName As String, Optional cosmosOptionsAction As Action(Of CosmosDbContextOptionsBuilder) = Nothing) As DbContextOptionsBuilder(Of TContext)

Type Parameters

TContext

The type of context to be configured.

Parameters

optionsBuilder
DbContextOptionsBuilder<TContext>

The builder being used to configure the context.

accountEndpoint
String

The account end-point to connect to.

accountKey
String

The account key.

databaseName
String

The database name.

cosmosOptionsAction
Action<CosmosDbContextOptionsBuilder>

An optional action to allow additional Cosmos-specific configuration.

Returns

The options builder so that further configuration can be chained.

Remarks

See Using DbContextOptions, and Accessing Azure Cosmos DB with EF Core for more information and examples.

Applies to