Share via


SqlServerDatabaseFacadeExtensions.IsSqlServer(DatabaseFacade) Method

Definition

Returns true if the database provider currently in use is the SQL Server provider.

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

Parameters

database
DatabaseFacade

The facade from Database.

Returns

true if SQL Server is being used; false otherwise.

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 SQL Server and Azure SQL databases with EF Core for more information and examples.

Applies to