CosmosDbContextOptionsExtensions.UseCosmos Method

Definition

Overloads

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

Configures the context to connect to a Azure Cosmos database.

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

Configures the context to connect to a 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, 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 a 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);
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

DbContextOptionsBuilder

The options builder so that further configuration can be chained.

Applies to

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

Configures the context to connect to a 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);
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

DbContextOptionsBuilder

The options builder so that further configuration can be chained.

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;
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

DbContextOptionsBuilder<TContext>

The options builder so that further configuration can be chained.

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;
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

DbContextOptionsBuilder<TContext>

The options builder so that further configuration can be chained.

Applies to