LocalDbConnectionFactory Class

 

Instances of this class are used to create DbConnection objects for SQL Server LocalDb based on a given database name or connection string.

Namespace:   System.Data.Entity.Infrastructure
Assembly:  EntityFramework (in EntityFramework.dll)

System.Object
  System.Data.Entity.Infrastructure.LocalDbConnectionFactory

public sealed class LocalDbConnectionFactory : IDbConnectionFactory

NameDescription
System_CAPS_pubmethodLocalDbConnectionFactory(String)

Creates a new instance of the connection factory for the given version of LocalDb. For SQL Server 2012 LocalDb use "v11.0". For SQL Server 2014 and later LocalDb use "mssqllocaldb".

System_CAPS_pubmethodLocalDbConnectionFactory(String, String)

Creates a new instance of the connection factory for the given version of LocalDb. For SQL Server 2012 LocalDb use "v11.0". For SQL Server 2014 and later LocalDb use "mssqllocaldb".

NameDescription
System_CAPS_pubpropertyBaseConnectionString

The connection string to use for options to the database other than the 'Initial Catalog', 'Data Source', and 'AttachDbFilename'. The 'Initial Catalog' and 'AttachDbFilename' will be prepended to this string based on the database name when CreateConnection is called. The 'Data Source' will be set based on the LocalDbVersion argument. The default is 'Integrated Security=True;'.

NameDescription
System_CAPS_pubmethodCreateConnection(String)

Creates a connection for SQL Server LocalDb based on the given database name or connection string. If the given string contains an '=' character then it is treated as a full connection string, otherwise it is treated as a database name only.

System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

An instance of this class can be set on the Database class or in the app.config/web.config for the application to cause all DbContexts created with no connection information or just a database name to use SQL Server LocalDb by default. This class is immutable since multiple threads may access instances simultaneously when creating connections.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.