Share via


IDbConnectionInterceptor.ConnectionOpening Method

Definition

Called just before EF intends to call Open().

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

Parameters

connection
DbConnection

The connection.

eventData
ConnectionEventData

Contextual information about the connection.

result
InterceptionResult

Represents the current result if one exists. This value will have IsSuppressed set to true if some previous interceptor suppressed execution by calling Suppress(). This value is typically used as the return value for the implementation of this method.

Returns

If IsSuppressed is false, then EF will continue as normal. If IsSuppressed is true, then EF will suppress the operation it was about to perform. An implementation of this method for any interceptor that is not attempting to suppress the operation is to return the result value passed in.

Applies to