SqlCeConnectionFactory Class
Collapse the table of content
Expand the table of content

SqlCeConnectionFactory Class

Entity Framework 5.0

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


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

public sealed class SqlCeConnectionFactory : IDbConnectionFactory

The SqlCeConnectionFactory type exposes the following members.

Public methodSqlCeConnectionFactory(String) Creates a new connection factory with empty (default) DatabaseDirectory and BaseConnectionString properties.
Public methodSqlCeConnectionFactory(String, String, String)Creates a new connection factory with the given DatabaseDirectory and BaseConnectionString properties.

Public propertyBaseConnectionStringThe connection string to use for options to the database other than the 'Data Source'. The Data Source will be prepended to this string based on the database name when CreateConnection is called. The default is the empty string, which means no other options will be used.
Public propertyDatabaseDirectoryThe path to prepend to the database name that will form the file name used by SQL Server Compact Edition when it creates or reads the database file. The default value is "|DataDirectory|", which means the file will be placed in the designated data directory.
Public propertyProviderInvariantNameThe provider invariant name that specifies the version of SQL Server Compact Edition that should be used.

Public methodCreateConnectionCreates a connection for SQL Server Compact Edition 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.
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)

It is necessary to provide the provider invariant name of the SQL Server Compact Edition to use when creating an instance of this class. This is because different versions of SQL Server Compact Editions use different invariant names. An instance of this class can be set on the Database class to cause all DbContext objects to be created with no connection information or just a database name or connection string to use SQL Server Compact Edition 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.
© 2015 Microsoft