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.
ファイルを表示 Open project: IdeaBlade/DevForce.Utilities Class Usage Examples

Public Methods

Method 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

Method Description
Initialize ( ) : void
PublishHandler ( object sender, EventArgs e ) : void

Method Details

GetMessageWithWait() public method

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

Reset() public method

public Reset ( ) : void
return void

SqlLogger() public method

public SqlLogger ( ) : System
return System