Share via


DbContextInfo Constructors

Definition

Overloads

DbContextInfo(Type)

Creates a new instance representing a given DbContext type.

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, 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)

Creates a new instance representing a given DbContext type.

public DbContextInfo (Type contextType);
new System.Data.Entity.Infrastructure.DbContextInfo : Type -> System.Data.Entity.Infrastructure.DbContextInfo
Public Sub New (contextType As Type)

Parameters

contextType
Type

The type deriving from DbContext.

Applies to

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.

public DbContextInfo (Type contextType, System.Configuration.Configuration config);
new System.Data.Entity.Infrastructure.DbContextInfo : Type * System.Configuration.Configuration -> System.Data.Entity.Infrastructure.DbContextInfo
Public Sub New (contextType As Type, config As Configuration)

Parameters

contextType
Type

The type deriving from DbContext.

config
Configuration

An object representing the config file.

Applies to

DbContextInfo(Type, ConnectionStringSettingsCollection)

Caution

The application configuration can contain multiple settings that affect the connection used by a DbContext. To ensure all configuration is taken into account, use a DbContextInfo constructor that accepts System.Configuration.Configuration

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.

[System.Obsolete("The application configuration can contain multiple settings that affect the connection used by a DbContext. To ensure all configuration is taken into account, use a DbContextInfo constructor that accepts System.Configuration.Configuration")]
public DbContextInfo (Type contextType, System.Configuration.ConnectionStringSettingsCollection connectionStringSettings);
new System.Data.Entity.Infrastructure.DbContextInfo : Type * System.Configuration.ConnectionStringSettingsCollection -> System.Data.Entity.Infrastructure.DbContextInfo
Public Sub New (contextType As Type, connectionStringSettings As ConnectionStringSettingsCollection)

Parameters

contextType
Type

The type deriving from DbContext.

connectionStringSettings
ConnectionStringSettingsCollection

A collection of connection strings.

Attributes

Remarks

It is preferable to use the constructor that accepts the entire config document instead of using this constructor. Providing the entire config document allows DefaultConnectionFactroy entries in the config to be found in addition to explicitly specified connection strings.

Applies to

DbContextInfo(Type, DbConnectionInfo)

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

public DbContextInfo (Type contextType, System.Data.Entity.Infrastructure.DbConnectionInfo connectionInfo);
new System.Data.Entity.Infrastructure.DbContextInfo : Type * System.Data.Entity.Infrastructure.DbConnectionInfo -> System.Data.Entity.Infrastructure.DbContextInfo
Public Sub New (contextType As Type, connectionInfo As DbConnectionInfo)

Parameters

contextType
Type

The type deriving from DbContext.

connectionInfo
DbConnectionInfo

Connection information for the database to be used.

Applies to

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.

public DbContextInfo (Type contextType, System.Data.Entity.Infrastructure.DbProviderInfo modelProviderInfo);
new System.Data.Entity.Infrastructure.DbContextInfo : Type * System.Data.Entity.Infrastructure.DbProviderInfo -> System.Data.Entity.Infrastructure.DbContextInfo
Public Sub New (contextType As Type, modelProviderInfo As DbProviderInfo)

Parameters

contextType
Type

The type deriving from DbContext.

modelProviderInfo
DbProviderInfo

A DbProviderInfo specifying the underlying ADO.NET provider to target.

Applies to

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.

public DbContextInfo (Type contextType, System.Configuration.Configuration config, System.Data.Entity.Infrastructure.DbConnectionInfo connectionInfo);
new System.Data.Entity.Infrastructure.DbContextInfo : Type * System.Configuration.Configuration * System.Data.Entity.Infrastructure.DbConnectionInfo -> System.Data.Entity.Infrastructure.DbContextInfo
Public Sub New (contextType As Type, config As Configuration, connectionInfo As DbConnectionInfo)

Parameters

contextType
Type

The type deriving from DbContext.

config
Configuration

An object representing the config file.

connectionInfo
DbConnectionInfo

Connection information for the database to be used.

Applies to

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.

public DbContextInfo (Type contextType, System.Configuration.Configuration config, System.Data.Entity.Infrastructure.DbProviderInfo modelProviderInfo);
new System.Data.Entity.Infrastructure.DbContextInfo : Type * System.Configuration.Configuration * System.Data.Entity.Infrastructure.DbProviderInfo -> System.Data.Entity.Infrastructure.DbContextInfo
Public Sub New (contextType As Type, config As Configuration, modelProviderInfo As DbProviderInfo)

Parameters

contextType
Type

The type deriving from DbContext.

config
Configuration

An object representing the config file.

modelProviderInfo
DbProviderInfo

A DbProviderInfo specifying the underlying ADO.NET provider to target.

Applies to