DataContext.Log DataContext.Log DataContext.Log DataContext.Log Property

Definición

Obtiene o establece el destino para escribir la consulta o comando SQL.Gets or sets the destination to write the SQL query or command.

public:
 property System::IO::TextWriter ^ Log { System::IO::TextWriter ^ get(); void set(System::IO::TextWriter ^ value); };
public System.IO.TextWriter Log { get; set; }
member this.Log : System.IO.TextWriter with get, set
Public Property Log As TextWriter

Valor de propiedad

TextReader que va a usarse para escribir el comando.The TextReader to use for writing the command.

Ejemplos

En el ejemplo siguiente se muestra el código SQL generado en la ventana de la consola antes de mostrar los resultados de la consulta.The following example displays generated SQL in the console window before it displays the results of the query.

db.Log = Console.Out;
var custQuery =
    from cust in db.Customers
    where cust.City == "London"
    select cust;

foreach (var custObj in custQuery)
{
    Console.WriteLine(custObj.ContactName);
}
db.Log = Console.Out
Dim custQuery = _
From cust In db.Customers _
Where cust.City = "London" _
Select cust

For Each custObj In custQuery
    Console.WriteLine(custObj.ContactName)
Next

Comentarios

Establezca esta propiedad en null para deshabilitar el registro de comandos.Set this property to null to disable command logging.

Se aplica a