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.
파일 보기 프로젝트 열기: IdeaBlade/DevForce.Utilities 1 사용 예제들

공개 메소드들

메소드 설명
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