SqlConnectionFactory.CreateConnection(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
public System.Data.Common.DbConnection CreateConnection (string nameOrConnectionString);
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
public System.Data.Common.DbConnection CreateConnection (string nameOrConnectionString);
abstract member CreateConnection : string -> System.Data.Common.DbConnection
override this.CreateConnection : string -> System.Data.Common.DbConnection
Public Function CreateConnection (nameOrConnectionString As String) As DbConnection
Parameters
- nameOrConnectionString
- String
The database name or connection string.
Returns
An initialized DbConnection.
Implements
- Attributes
Applies to
Samarbeta med oss på GitHub
Källan för det här innehållet finns på GitHub, där du även kan skapa och granska ärenden och pull-begäranden. Se vår deltagarguide för mer information.
Entity Framework