다음을 통해 공유


IDbConnectionInterceptor.ConnectionCreating 메서드

정의

EF가 을 만들기 직전에 호출합니다 DbConnection. 애플리케이션에서 사용할 연결을 제공하는 경우 이 이벤트는 트리거되지 않습니다.

public virtual Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbConnection> ConnectionCreating (Microsoft.EntityFrameworkCore.Diagnostics.ConnectionCreatingEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbConnection> result);
abstract member ConnectionCreating : Microsoft.EntityFrameworkCore.Diagnostics.ConnectionCreatingEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbConnection> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbConnection>
override this.ConnectionCreating : Microsoft.EntityFrameworkCore.Diagnostics.ConnectionCreatingEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbConnection> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbConnection>
Public Overridable Function ConnectionCreating (eventData As ConnectionCreatingEventData, result As InterceptionResult(Of DbConnection)) As InterceptionResult(Of DbConnection)

매개 변수

eventData
ConnectionCreatingEventData

연결에 대한 컨텍스트 정보입니다.

result
InterceptionResult<DbConnection>

있는 경우 현재 결과를 나타냅니다. 이전의 일부 인터셉터에서 를 호출SuppressWithResult(TResult)하여 true 실행을 억제한 경우 이 값은 로 설정됩니다HasResult. 이 값은 일반적으로이 메서드의 구현에 대 한 반환 값으로 사용 합니다.

반환

가 이falseHasResult EF는 정상적으로 계속됩니다. 가 이trueHasResult EF는 수행하려고 하던 작업을 표시하지 않고 대신 사용합니다Result. 결과를 변경하려고 하지 않는 인터셉터에 대해 이 메서드의 구현은 전달된 값을 반환 result 해야 합니다.

적용 대상