DatabaseFacade.ProviderName Property

Definition

Returns the name of the database provider currently in use. The name is typically the name of the provider assembly. It is usually easier to use a sugar method such as Microsoft.EntityFrameworkCore.SqlServerDatabaseFacadeExtensions.IsSqlServer instead of calling this method directly.

public virtual string ProviderName { get; }
public virtual string? ProviderName { get; }
member this.ProviderName : string
Public Overridable ReadOnly Property ProviderName As String

Property Value

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 DbContext lifetime, configuration, and initialization for more information and examples.

Applies to