共用方式為


CosmosDbContextOptionsExtensions.UseCosmos 方法

定義

多載

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

設定內容以連線到 Azure Cosmos 資料庫。

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

設定內容以連線到 Azure Cosmos 資料庫。

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

設定內容以連線到 Azure Cosmos 資料庫。

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

設定內容以連線到 Azure Cosmos 資料庫。

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

設定內容以連線到 Azure Cosmos 資料庫。

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

設定內容以連線到 Azure Cosmos 資料庫。

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

設定內容以連線到 Azure Cosmos 資料庫。

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

參數

optionsBuilder
DbContextOptionsBuilder

用來設定內容的產生器。

connectionString
String

要連線的資料庫連接字串。

databaseName
String

資料庫名稱。

cosmosOptionsAction
Action<CosmosDbContextOptionsBuilder>

選擇性動作,可允許其他 Cosmos 特定組態。

傳回

選項產生器,以便進一步的設定可以鏈結。

備註

如需詳細資訊和範例,請參閱搭配 EF Core 使用 DbCoNtextOptions存取 Azure Cosmos DB

適用於

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

設定內容以連線到 Azure Cosmos 資料庫。

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

參數

optionsBuilder
DbContextOptionsBuilder

用來設定內容的產生器。

accountEndpoint
String

要連線的帳戶端點。

tokenCredential
TokenCredential

Azure 驗證權杖。

databaseName
String

資料庫名稱。

cosmosOptionsAction
Action<CosmosDbContextOptionsBuilder>

選擇性動作,可允許其他 Cosmos 特定組態。

傳回

選項產生器,以便進一步的設定可以鏈結。

備註

如需詳細資訊和範例,請參閱搭配 EF Core 使用 DbCoNtextOptions存取 Azure Cosmos DB

適用於

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

設定內容以連線到 Azure Cosmos 資料庫。

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

參數

optionsBuilder
DbContextOptionsBuilder

用來設定內容的產生器。

accountEndpoint
String

要連線的帳戶端點。

accountKey
String

帳戶金鑰。

databaseName
String

資料庫名稱。

cosmosOptionsAction
Action<CosmosDbContextOptionsBuilder>

選擇性動作,可允許其他 Cosmos 特定組態。

傳回

選項產生器,以便進一步的設定可以鏈結。

備註

如需詳細資訊和範例,請參閱搭配 EF Core 使用 DbCoNtextOptions存取 Azure Cosmos DB

適用於

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

設定內容以連線到 Azure Cosmos 資料庫。

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)

類型參數

TContext

要設定的內容類型。

參數

optionsBuilder
DbContextOptionsBuilder<TContext>

用來設定內容的產生器。

connectionString
String

要連線的資料庫連接字串。

databaseName
String

資料庫名稱。

cosmosOptionsAction
Action<CosmosDbContextOptionsBuilder>

選擇性動作,可允許其他 Cosmos 特定組態。

傳回

選項產生器,以便進一步的設定可以鏈結。

備註

如需詳細資訊和範例,請參閱搭配 EF Core 使用 DbCoNtextOptions存取 Azure Cosmos DB

適用於

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

設定內容以連線到 Azure Cosmos 資料庫。

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)

類型參數

TContext

要設定的內容類型。

參數

optionsBuilder
DbContextOptionsBuilder<TContext>

用來設定內容的產生器。

accountEndpoint
String

要連線的帳戶端點。

tokenCredential
TokenCredential

Azure 驗證權杖。

databaseName
String

資料庫名稱。

cosmosOptionsAction
Action<CosmosDbContextOptionsBuilder>

選擇性動作,可允許其他 Cosmos 特定組態。

傳回

選項產生器,以便進一步的設定可以鏈結。

備註

如需詳細資訊和範例,請參閱搭配 EF Core 使用 DbCoNtextOptions存取 Azure Cosmos DB

適用於

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

設定內容以連線到 Azure Cosmos 資料庫。

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)

類型參數

TContext

要設定的內容類型。

參數

optionsBuilder
DbContextOptionsBuilder<TContext>

用來設定內容的產生器。

accountEndpoint
String

要連線的帳戶端點。

accountKey
String

帳戶金鑰。

databaseName
String

資料庫名稱。

cosmosOptionsAction
Action<CosmosDbContextOptionsBuilder>

選擇性動作,可允許其他 Cosmos 特定組態。

傳回

選項產生器,以便進一步的設定可以鏈結。

備註

如需詳細資訊和範例,請參閱搭配 EF Core 使用 DbCoNtextOptions存取 Azure Cosmos DB

適用於