Database.Log Property

Definition

Set this property to log the SQL generated by the DbContext to the given delegate. For example, to log to the console, set this property to Write(String).

public Action<string> Log { get; set; }
member this.Log : Action<string> with get, set
Public Property Log As Action(Of String)

Property Value

Remarks

The format of the log text can be changed by creating a new formatter that derives from DatabaseLogFormatter and setting it with SetDatabaseLogFormatter(Func<DbContext,Action<String>,DatabaseLogFormatter>). For more low-level control over logging/interception see IDbCommandInterceptor and DbInterception.

Applies to