Share via


IDbConnectionFactory Interface

Definition

Implementations of this interface are used to create DbConnection objects for a type of database server based on a given database name. An Instance is set on the Database class to cause all DbContexts created with no connection information or just a database name or connection string to use a certain type of database server by default. Two implementations of this interface are provided: SqlConnectionFactory is used to create connections to Microsoft SQL Server, including EXPRESS editions. SqlCeConnectionFactory is used to create connections to Microsoft SQL Server Compact Editions. Other implementations for other database servers can be added as needed. Note that implementations should be thread safe or immutable since they may be accessed by multiple threads at the same time.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", Justification="Casing is intentional")]
public interface IDbConnectionFactory
public interface IDbConnectionFactory
type IDbConnectionFactory = interface
Public Interface IDbConnectionFactory
Derived
Attributes

Methods

CreateConnection(String)

Creates a connection based on the given database name or connection string.

Applies to