DbContextInfo Class

Definition

Provides runtime information about a given DbContext type.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Justification="Casing is intentional")]
public class DbContextInfo
public class DbContextInfo
type DbContextInfo = class
Public Class DbContextInfo
Inheritance
DbContextInfo
Attributes

Constructors

DbContextInfo(Type, Configuration, DbConnectionInfo)

Creates a new instance representing a given DbContext, targeting a specific database. An external config object (e.g. app.config or web.config) can be supplied and will be used during connection string resolution. This includes looking for connection strings and DefaultConnectionFactory entries.

DbContextInfo(Type, Configuration, DbProviderInfo)

Creates a new instance representing a given DbContext type. An external config object (e.g. app.config or web.config) can be supplied and will be used during connection string resolution. This includes looking for connection strings and DefaultConnectionFactory entries. A DbProviderInfo can be supplied in order to override the default determined provider used when constructing the underlying EDM model. This can be useful to prevent EF from connecting to discover a manifest token.

DbContextInfo(Type, Configuration)

Creates a new instance representing a given DbContext type. An external config object (e.g. app.config or web.config) can be supplied and will be used during connection string resolution. This includes looking for connection strings and DefaultConnectionFactory entries.

DbContextInfo(Type, ConnectionStringSettingsCollection)
Obsolete.

Creates a new instance representing a given DbContext type. An external list of connection strings can be supplied and will be used during connection string resolution in place of any connection strings specified in external configuration files.

DbContextInfo(Type, DbConnectionInfo)

Creates a new instance representing a given DbContext targeting a specific database.

DbContextInfo(Type, DbProviderInfo)

Creates a new instance representing a given DbContext type. A DbProviderInfo can be supplied in order to override the default determined provider used when constructing the underlying EDM model.

DbContextInfo(Type)

Creates a new instance representing a given DbContext type.

Properties

ConnectionProviderName

The ADO.NET provider name of the connection used by the underlying DbContext type.

ConnectionString

The connection string used by the underlying DbContext type.

ConnectionStringName

The connection string name used by the underlying DbContext type.

ConnectionStringOrigin

The origin of the connection string used by the underlying DbContext type.

ContextType

The concrete DbContext type.

IsConstructible

Whether or not instances of the underlying DbContext type can be created.

OnModelCreating

An action to be run on the DbModelBuilder after OnModelCreating has been run on the context.

Methods

CreateInstance()

If instances of the underlying DbContext type can be created, returns a new instance; otherwise returns null.

Applies to