C# Class 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.
Afficher le fichier Open project: IdeaBlade/DevForce.Utilities Class Usage Examples

Méthodes publiques

Méthode Description
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

Private Methods

Méthode Description
Initialize ( ) : void
PublishHandler ( object sender, EventArgs e ) : void

Method Details

GetMessageWithWait() public méthode

This will wait for up to 1 full second to obtain a logged SQL message (if not already received).
public GetMessageWithWait ( ) : string
Résultat string

Reset() public méthode

public Reset ( ) : void
Résultat void

SqlLogger() public méthode

public SqlLogger ( ) : System
Résultat System