C# Класс IdeaBlade.Drivers.SqlLogger

Utility class which will obtain the SQL for a query. DevForce does not generate SQL: it allows EF to do this, on the server, wwhen a DevForce query is reshaped as an ObjectQuery. Because of this, DevForce never really has the generated SQL, it must ask EF for it. To obtain the SQL here we're turning on a DevForce logging attribute, "ShouldLogSqlQueries", to allow SQL messages to be written by the DevForce trace publisher. We're then subscribing to the publisher and looking only for messages coming from a specific source. The publishing mechanism within DevForce runs on a separate thread, and pushes out all trace/debug messages. LINQPad needs the SQL for display purposes by the time the query has finished executing - which is a problem for us because the trace message may not have been published or received yet. To work around this, the driver will call here to pull the SQL message, with a short wait if necessary, instead of something more intuitive like using an event handler.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
GetMessageWithWait ( ) : string

This will wait for up to 1 full second to obtain a logged SQL message (if not already received).

Reset ( ) : void
SqlLogger ( ) : System

Приватные методы

Метод Описание
Initialize ( ) : void
PublishHandler ( object sender, EventArgs e ) : void

Описание методов

GetMessageWithWait() публичный Метод

This will wait for up to 1 full second to obtain a logged SQL message (if not already received).
public GetMessageWithWait ( ) : string
Результат string

Reset() публичный Метод

public Reset ( ) : void
Результат void

SqlLogger() публичный Метод

public SqlLogger ( ) : System
Результат System