SqlConnectionFactory.CreateConnection Method (String)

 

Creates a connection for SQL Server 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.

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

[SuppressMessageAttribute("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
[SuppressMessageAttribute("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
public DbConnection CreateConnection(
	string nameOrConnectionString
)

Parameters

nameOrConnectionString
Type: System.String

The database name or connection string.

Return Value

Type: System.Data.Common.DbConnection

An initialized DbConnection.