DataContext 생성자
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
DataContext 클래스의 새 인스턴스를 초기화합니다. 사용하는 연결 문자열 ADO.NET 연결 문자열 수 있습니다. SQL Server Express 또는 SQL Server Compact 파일에 파일 이름을 지정할 수도 있습니다.
오버로드
| Name | Description |
|---|---|
| DataContext(IDbConnection) |
.NET Framework에서 사용하는 연결을 참조하여 DataContext 클래스의 새 인스턴스를 초기화합니다. |
| DataContext(String) |
파일 원본을 참조하여 클래스의 DataContext 새 인스턴스를 초기화합니다. |
| DataContext(IDbConnection, MappingSource) |
연결 및 매핑 소스를 참조하여 클래스의 DataContext 새 인스턴스를 초기화합니다. |
| DataContext(String, MappingSource) |
파일 원본 및 매핑 소스를 참조하여 클래스의 DataContext 새 인스턴스를 초기화합니다. |
DataContext(IDbConnection)
.NET Framework에서 사용하는 연결을 참조하여 DataContext 클래스의 새 인스턴스를 초기화합니다.
public:
DataContext(System::Data::IDbConnection ^ connection);
public DataContext(System.Data.IDbConnection connection);
new System.Data.Linq.DataContext : System.Data.IDbConnection -> System.Data.Linq.DataContext
Public Sub New (connection As IDbConnection)
매개 변수
- connection
- IDbConnection
.NET Framework에서 사용하는 연결입니다.
설명
닫힌 연결 또는 연결 문자열 제공하는 경우 필요에 따라 DataContext 열리고 데이터베이스 연결을 닫습니다. 일반적으로 호출할 DisposeDataContext필요가 없습니다. 열린 연결을 제공하는 경우 연결을 DataContext 닫지 않습니다. 따라서 이 작업을 수행할 충분한 이유가 없다면 열린 연결로 인스턴스화 DataContext 하지 마세요.
System.Transactions 트랜잭션에서 승격을 DataContext 방지하기 위해 연결을 열거나 닫지 않습니다.
적용 대상
DataContext(String)
파일 원본을 참조하여 클래스의 DataContext 새 인스턴스를 초기화합니다.
public:
DataContext(System::String ^ fileOrServerOrConnection);
public DataContext(string fileOrServerOrConnection);
new System.Data.Linq.DataContext : string -> System.Data.Linq.DataContext
Public Sub New (fileOrServerOrConnection As String)
매개 변수
- fileOrServerOrConnection
- String
이 인수는 SQL Server Express 데이터베이스가 있는 파일의 이름 중 하나일 수 있습니다.
데이터베이스가 있는 서버의 이름입니다. 이 경우 공급자는 사용자에 대한 기본 데이터베이스를 사용합니다.
전체 연결 문자열. LINQ to SQL은 수정 없이 문자열을 공급자에 전달합니다.
적용 대상
DataContext(IDbConnection, MappingSource)
연결 및 매핑 소스를 참조하여 클래스의 DataContext 새 인스턴스를 초기화합니다.
public:
DataContext(System::Data::IDbConnection ^ connection, System::Data::Linq::Mapping::MappingSource ^ mapping);
public DataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mapping);
new System.Data.Linq.DataContext : System.Data.IDbConnection * System.Data.Linq.Mapping.MappingSource -> System.Data.Linq.DataContext
Public Sub New (connection As IDbConnection, mapping As MappingSource)
매개 변수
- connection
- IDbConnection
.NET Framework에서 사용하는 연결입니다.
- mapping
- MappingSource
매핑을 위한 원본입니다.
적용 대상
DataContext(String, MappingSource)
파일 원본 및 매핑 소스를 참조하여 클래스의 DataContext 새 인스턴스를 초기화합니다.
public:
DataContext(System::String ^ fileOrServerOrConnection, System::Data::Linq::Mapping::MappingSource ^ mapping);
public DataContext(string fileOrServerOrConnection, System.Data.Linq.Mapping.MappingSource mapping);
new System.Data.Linq.DataContext : string * System.Data.Linq.Mapping.MappingSource -> System.Data.Linq.DataContext
Public Sub New (fileOrServerOrConnection As String, mapping As MappingSource)
매개 변수
- fileOrServerOrConnection
- String
이 인수는 다음 중 하나일 수 있습니다.
SQL Server Express 데이터베이스가 있는 파일의 이름입니다.
데이터베이스가 있는 서버의 이름입니다. 이 경우 공급자는 사용자에 대한 기본 데이터베이스를 사용합니다.
전체 연결 문자열. LINQ to SQL은 수정 없이 문자열을 공급자에 전달합니다.
- mapping
- MappingSource
매핑을 위한 원본입니다.