Condividi tramite


Proprietà Database.Log

[Questa pagina è specifica della versione 6 di Entity Framework. La versione più recente è disponibile come pacchetto NuGet per "Entity Framework". Per ulteriori informazioni su Entity Framework, vedere la pagina msdn.com/data/ef.]

Imposta questa proprietà per registrare il codice SQL generato da DbContext nel delegato specificato. Ad esempio, per registrare nella console, imposta questa proprietà su Write(String).

Spazio dei nomi:  System.Data.Entity
Assembly:  EntityFramework (in EntityFramework.dll)

Sintassi

'Dichiarazione
Public Property Log As Action(Of String)
    Get 
    Set
'Utilizzo
Dim instance As Database 
Dim value As Action(Of String)

value = instance.Log

instance.Log = value
public Action<string> Log { get; set; }
public:
property Action<String^>^ Log {
    Action<String^>^ get ();
    void set (Action<String^>^ value);
}
member Log : Action<string> with get, set
function get Log () : Action<String>
function set Log (value : Action<String>)

Valore proprietà

Tipo: System.Action<String>

Note

È possibile cambiare il formato del test del log creando un nuovo formattatore che deriva da DatabaseLogFormatter e impostandolo con SetDatabaseLogFormatter(Func<DbContext, Action<String>, DatabaseLogFormatter>). Per un controllo di livello più basso sulla registrazione/intercettazione, vedere IDbCommandInterceptor e DbInterception.

Vedere anche

Riferimento

Database Classe

Spazio dei nomi System.Data.Entity