Share via


CosmosDatabaseFacadeExtensions.IsCosmos(DatabaseFacade) Method

Definition

Returns true if the database provider currently in use is the Cosmos provider.

public static bool IsCosmos (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade database);
static member IsCosmos : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade -> bool
<Extension()>
Public Function IsCosmos (database As DatabaseFacade) As Boolean

Parameters

database
DatabaseFacade

The facade from Database.

Returns

true if the Cosmos provider is being used.

Remarks

This method can only be used after the DbContext has been configured because it is only then that the provider is known. This means that this method cannot be used in OnConfiguring(DbContextOptionsBuilder) because this is where application code sets the provider to use as part of configuring the context.

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

Applies to