EntityConnection 클래스
정의
개념적 모델 및 데이터 소스 연결에 대한 참조를 포함합니다.Contains a reference to a conceptual model and a data source connection. 이 클래스는 상속될 수 없습니다.This class cannot be inherited.
public ref class EntityConnection sealed : System::Data::Common::DbConnection
public sealed class EntityConnection : System.Data.Common.DbConnection
type EntityConnection = class
inherit DbConnection
Public NotInheritable Class EntityConnection
Inherits DbConnection
- 상속
설명
실수로 System.Data.Common.CommandTrees 및 ObjectContext 같은 개체가 해당 메타데이터와 비동기화되지 않도록 방지하려면 EntityConnection에서 메타데이터를 잠가야 합니다.To avoid inadvertently putting objects such as System.Data.Common.CommandTrees and ObjectContext out of sync with their metadata, EntityConnection must lock its metadata. 메타데이터가 잠긴 후에는 연결 문자열을 변경할 수 없습니다.No changes to the connection string are allowed after the metadata is locked. 메타데이터가 잠기는 두 가지 시나리오는 다음과 같습니다.The following are two scenarios in which metadata is locked:
EntityConnection인스턴스는 매개 변수가 없는 생성자를 통해 생성 되거나 EntityConnection(String) 연결 문자열을 허용 하는 생성자를 통해 생성 됩니다.The EntityConnection instance is constructed through the parameterless constructor, or through the EntityConnection(String) constructor, which accepts a connection string. 어느 경우든 연결이 열리기 이전에 연결 문자열이 여러 번 변경될 수 있습니다.In either case the connection string might be changed multiple times before the connection is opened. Open 또는 GetMetadataWorkspace를 호출하면 메타데이터가 잠깁니다.Calling Open or GetMetadataWorkspace locks the metadata.
EntityConnection 인스턴스가 EntityConnection(MetadataWorkspace, DbConnection) 및 MetadataWorkspace을 허용하는 DbConnection 생성자를 통해 생성됩니다.The EntityConnection instance is constructed through the EntityConnection(MetadataWorkspace, DbConnection) constructor, which accepts a MetadataWorkspace and a DbConnection. 이 경우 메타데이터는 생성 시에 잠기므로In this case, the metadata is locked at construction time. 연결 문자열을 절대 변경할 수 없습니다.No changes to the connection string are ever allowed.
메타데이터가 로드되면 EntityConnection은 개념적 모델, 스토리지 모델 및 매핑 파일이 모두 있는지 확인합니다.When metadata is loaded, the EntityConnection verifies that the conceptual model, the storage model, and the mapping file are all present.
코드 예제를 보려면 EntityClient 작업합니다.For code examples, see Working with EntityClient.
생성자
EntityConnection() |
EntityConnection 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the EntityConnection class. |
EntityConnection(MetadataWorkspace, DbConnection) |
지정된 EntityConnection와 MetadataWorkspace을 사용하여 DbConnection 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the EntityConnection class with a specified MetadataWorkspace and DbConnection. |
EntityConnection(String) |
연결 문자열을 기반으로 EntityConnection 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the EntityConnection class, based on the connection string. |
속성
CanRaiseEvents |
구성 요소가 이벤트를 발생시킬 수 있는지 여부를 나타내는 값을 가져옵니다.Gets a value indicating whether the component can raise an event. (다음에서 상속됨 Component) |
ConnectionString |
EntityConnection 연결 문자열을 가져오거나 설정합니다.Gets or sets the EntityConnection connection string. |
ConnectionTimeout |
연결을 설정할 때 연결 시도를 끝내고 오류를 생성하기 전까지 대기할 시간(초)을 가져옵니다.Gets the number of seconds to wait when attempting to establish a connection before ending the attempt and generating an error. |
Container |
IContainer을 포함하는 Component를 가져옵니다.Gets the IContainer that contains the Component. (다음에서 상속됨 Component) |
Database |
현재 데이터베이스의 이름 또는 연결이 열린 후에 사용될 데이터베이스의 이름을 가져옵니다.Gets the name of the current database, or the database that will be used after a connection is opened. |
DataSource |
연결할 데이터 소스의 이름이나 네트워크 주소를 가져옵니다.Gets the name or network address of the data source to connect to. |
DbProviderFactory |
이 DbProviderFactory의 DbConnection를 가져옵니다.Gets the DbProviderFactory for this DbConnection. (다음에서 상속됨 DbConnection) |
DesignMode |
Component가 현재 디자인 모드인지 여부를 나타내는 값을 가져옵니다.Gets a value that indicates whether the Component is currently in design mode. (다음에서 상속됨 Component) |
Events |
이 Component에 연결된 이벤트 처리기의 목록을 가져옵니다.Gets the list of event handlers that are attached to this Component. (다음에서 상속됨 Component) |
ServerVersion |
클라이언트가 연결된 데이터 원본의 버전이 포함된 문자열을 가져옵니다.Gets a string that contains the version of the data source to which the client is connected. |
Site |
Component의 ISite를 가져오거나 설정합니다.Gets or sets the ISite of the Component. (다음에서 상속됨 Component) |
State |
ConnectionState이 열려 있으면 기본 공급자의 EntityConnection 속성을 가져오고,Gets the ConnectionState property of the underlying provider if the EntityConnection is open. 그렇지 않으면 Closed을(를) 반환합니다.Otherwise, returns Closed. |
StoreConnection |
개체에서 사용하는 기본 데이터 원본 연결에 액세스할 수 있도록 합니다.Provides access to the underlying data source connection that is used by the EntityConnection object. |
메서드
BeginDbTransaction(IsolationLevel) |
파생 클래스에서 재정의되는 경우 데이터베이스 트랜잭션을 시작합니다.When overridden in a derived class, starts a database transaction. (다음에서 상속됨 DbConnection) |
BeginDbTransactionAsync(IsolationLevel, CancellationToken) |
데이터베이스 트랜잭션을 비동기적으로 시작합니다.Asynchronously starts a database transaction. (다음에서 상속됨 DbConnection) |
BeginTransaction() |
기본 공급자를 사용하여 트랜잭션을 시작합니다.Begins a transaction by using the underlying provider. |
BeginTransaction(IsolationLevel) |
기본 공급자를 사용하여 지정된 격리 수준의 트랜잭션을 시작합니다.Begins a transaction with the specified isolation level by using the underlying provider. |
BeginTransactionAsync(CancellationToken) |
비동기적으로 데이터베이스 트랜잭션을 시작합니다.Asynchronously begins a database transaction. (다음에서 상속됨 DbConnection) |
BeginTransactionAsync(IsolationLevel, CancellationToken) |
비동기적으로 데이터베이스 트랜잭션을 시작합니다.Asynchronously begins a database transaction. (다음에서 상속됨 DbConnection) |
ChangeDatabase(String) |
지원되지 않습니다.Not supported. |
ChangeDatabaseAsync(String, CancellationToken) |
열려 있는 연결의 현재 데이터베이스를 비동기적으로 변경합니다.Asynchronously changes the current database for an open connection. (다음에서 상속됨 DbConnection) |
Close() |
데이터베이스에 대한 연결을 닫습니다.Closes the connection to the database. |
CloseAsync() |
데이터베이스에 대한 연결을 비동기적으로 닫습니다.Asynchronously closes the connection to the database. (다음에서 상속됨 DbConnection) |
CreateCommand() |
EntityCommand의 새 인스턴스를 만들고 Connection을 이 EntityConnection으로 설정합니다.Creates a new instance of an EntityCommand, with the Connection set to this EntityConnection. |
CreateDbCommand() |
파생 클래스에서 재정의되는 경우 현재 연결과 관련된 DbCommand 개체를 만들고 반환합니다.When overridden in a derived class, creates and returns a DbCommand object associated with the current connection. (다음에서 상속됨 DbConnection) |
CreateObjRef(Type) |
원격 개체와 통신하는 데 사용되는 프록시 생성에 필요한 모든 관련 정보가 들어 있는 개체를 만듭니다.Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (다음에서 상속됨 MarshalByRefObject) |
Dispose() |
관리되지 않는 리소스의 확보, 해제 또는 다시 설정과 관련된 애플리케이션 정의 작업을 수행합니다.Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (다음에서 상속됨 DbConnection) |
Dispose(Boolean) |
DbConnection에서 사용하는 관리되지 않는 리소스를 해제하고, 관리되는 리소스를 선택적으로 해제할 수 있습니다.Releases the unmanaged resources used by the DbConnection and optionally releases the managed resources. (다음에서 상속됨 DbConnection) |
DisposeAsync() |
연결 개체를 비동기적으로 삭제합니다.Asynchronously diposes the connection object. (다음에서 상속됨 DbConnection) |
EnlistTransaction(Transaction) |
지정된 트랜잭션에 이 EntityConnection을 인리스트먼트합니다.Enlists this EntityConnection in the specified transaction. |
Equals(Object) |
지정된 개체가 현재 개체와 같은지 확인합니다.Determines whether the specified object is equal to the current object. (다음에서 상속됨 Object) |
GetHashCode() |
기본 해시 함수로 작동합니다.Serves as the default hash function. (다음에서 상속됨 Object) |
GetLifetimeService() |
이 인스턴스의 수명 정책을 제어하는 현재의 수명 서비스 개체를 검색합니다.Retrieves the current lifetime service object that controls the lifetime policy for this instance. (다음에서 상속됨 MarshalByRefObject) |
GetMetadataWorkspace() |
이 MetadataWorkspace과 연결된 EntityConnection를 반환합니다.Returns the MetadataWorkspace associated with this EntityConnection. |
GetSchema() |
이 DbConnection의 데이터 소스에 대한 구성표 정보를 반환합니다.Returns schema information for the data source of this DbConnection. (다음에서 상속됨 DbConnection) |
GetSchema(String) |
스키마 이름에 대해 지정된 문자열을 사용하여 이 DbConnection의 데이터 소스에 대한 스키마 정보를 반환합니다.Returns schema information for the data source of this DbConnection using the specified string for the schema name. (다음에서 상속됨 DbConnection) |
GetSchema(String, String[]) |
스키마 이름에 대해 지정된 문자열과 제한 값에 대해 지정된 문자열 배열을 사용하여 이 DbConnection의 데이터 소스에 대한 스키마 정보를 반환합니다.Returns schema information for the data source of this DbConnection using the specified string for the schema name and the specified string array for the restriction values. (다음에서 상속됨 DbConnection) |
GetSchemaAsync(CancellationToken) |
GetSchema()의 비동기 버전입니다.This is an asynchronous version of GetSchema().
공급자는 적절한 구현을 재정의해야 합니다.Providers should override with an appropriate implementation.
|
GetSchemaAsync(String, CancellationToken) |
GetSchema(String)의 비동기 버전입니다.This is the asynchronous version of GetSchema(String).
공급자는 적절한 구현을 재정의해야 합니다.Providers should override with an appropriate implementation.
|
GetSchemaAsync(String, String[], CancellationToken) |
GetSchema(String, String[])의 비동기 버전입니다.This is the asynchronous version of GetSchema(String, String[]).
공급자는 적절한 구현을 재정의해야 합니다.Providers should override with an appropriate implementation.
|
GetService(Type) |
Component 또는 해당 Container에서 제공하는 서비스를 나타내는 개체를 반환합니다.Returns an object that represents a service provided by the Component or by its Container. (다음에서 상속됨 Component) |
GetType() |
현재 인스턴스의 Type을 가져옵니다.Gets the Type of the current instance. (다음에서 상속됨 Object) |
InitializeLifetimeService() |
이 인스턴스의 수명 정책을 제어하는 수명 서비스 개체를 가져옵니다.Obtains a lifetime service object to control the lifetime policy for this instance. (다음에서 상속됨 MarshalByRefObject) |
MemberwiseClone() |
현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object. (다음에서 상속됨 Object) |
MemberwiseClone(Boolean) |
현재 MarshalByRefObject 개체의 단순 복사본을 만듭니다.Creates a shallow copy of the current MarshalByRefObject object. (다음에서 상속됨 MarshalByRefObject) |
OnStateChange(StateChangeEventArgs) |
StateChange 이벤트를 발생시킵니다.Raises the StateChange event. (다음에서 상속됨 DbConnection) |
Open() |
기본 데이터 공급자의 |
OpenAsync() |
Open()으로 지정된 설정을 사용하여 데이터베이스 연결을 여는 ConnectionString의 비동기 버전입니다.An asynchronous version of Open(), which opens a database connection with the settings specified by the ConnectionString. 이 메서드는 CancellationToken.None을 사용하여 가상 메서드 OpenAsync(CancellationToken)를 호출합니다.This method invokes the virtual method OpenAsync(CancellationToken) with CancellationToken.None. (다음에서 상속됨 DbConnection) |
OpenAsync(CancellationToken) |
Open()의 비동기 버전입니다.This is the asynchronous version of Open(). 공급자는 적절한 구현을 재정의해야 합니다.Providers should override with an appropriate implementation. 취소 토큰은 선택적으로 적용될 수 있습니다.The cancellation token can optionally be honored. 기본 구현은 동기 Open() 호출을 호출하고 완료된 작업을 반환합니다.The default implementation invokes the synchronous Open() call and returns a completed task. 기본 구현은 이미 취소된 cancellationToken을 전달하는 경우 취소된 작업을 반환합니다.The default implementation will return a cancelled task if passed an already cancelled cancellationToken. Open에서 throw되는 예외는 반환된 Task Exception 속성을 통해 전달됩니다.Exceptions thrown by Open will be communicated via the returned Task Exception property. 반환된 작업이 완료될 때까지 |
ToString() |
Component의 이름이 포함된 String을 반환합니다(있는 경우).Returns a String containing the name of the Component, if any. 이 메서드는 재정의할 수 없습니다.This method should not be overridden. (다음에서 상속됨 Component) |
이벤트
Disposed |
Dispose() 메서드를 호출하여 구성 요소를 삭제할 때 발생합니다.Occurs when the component is disposed by a call to the Dispose() method. (다음에서 상속됨 Component) |
StateChange |
연결 상태가 변경될 때 발생합니다.Occurs when the state of the connection changes. (다음에서 상속됨 DbConnection) |
명시적 인터페이스 구현
IDbConnection.BeginTransaction() |
데이터베이스 트랜잭션을 시작합니다.Begins a database transaction. (다음에서 상속됨 DbConnection) |
IDbConnection.BeginTransaction(IsolationLevel) |
지정된 격리 수준으로 데이터베이스 트랜잭션을 시작합니다.Begins a database transaction with the specified isolation level. (다음에서 상속됨 DbConnection) |
IDbConnection.CreateCommand() |
현재 연결과 관련된 DbCommand 개체를 만들고 반환합니다.Creates and returns a DbCommand object that is associated with the current connection. (다음에서 상속됨 DbConnection) |