C# 클래스 Subtext.Scripting.SqlScriptRunner

Class used to manage and execute SQL scripts. Can also be used to hand
상속: IScript, ITemplateScript
파일 보기 프로젝트 열기: ayende/Subtext 1 사용 예제들

공개 메소드들

메소드 설명
Execute ( SqlTransaction transaction ) : int

Executes the script.

Use script.Execute(transaction) to do the work. We will also pull the status of our script exection from here.

SqlScriptRunner ( Assembly assemblyWithEmbeddedScript, Type scopingType, string scriptName, Encoding encoding ) : System

Initializes a new instance of the SqlScriptRunner class.

SqlScriptRunner ( Assembly assemblyWithEmbeddedScript, string fullScriptName, Encoding encoding ) : System

Initializes a new instance of the SqlScriptRunner class. Initializes the script to execute.

SqlScriptRunner ( ScriptCollection scripts ) : System

Initializes a new instance of the SqlScriptRunner class.

SqlScriptRunner ( Stream scriptStream, Encoding encoding ) : System

Initializes a new instance of the SqlScriptRunner class.

SqlScriptRunner ( Type scopingType, string scriptName, Encoding encoding ) : System

Initializes a new instance of the SqlScriptRunner class. Initializes the script to execute.

SqlScriptRunner ( string scriptText ) : System

Initializes a new instance of the SqlScriptRunner class.

비공개 메소드들

메소드 설명
IsCrudScript ( Script script ) : bool
ReadStream ( Stream stream, Encoding encoding ) : string
SetNoCountOff ( SqlTransaction transaction ) : void

Temporarily set NOCOUNT OFF on the connection. We must do this b/c the SqlScriptRunner depends on all CRUD statements returning the number of effected rows to determine if an error occured. This isn't a perfect solution, but it's what we've got.

UnpackEmbeddedScript ( Assembly assembly, Type scopingType, string scriptName ) : Stream
UnpackEmbeddedScript ( Assembly assembly, string fullScriptName ) : Stream
UnpackEmbeddedScript ( Type scopingType, string scriptName ) : Stream

메소드 상세

Execute() 공개 메소드

Executes the script.
Use script.Execute(transaction) to do the work. We will also pull the status of our script exection from here.
public Execute ( SqlTransaction transaction ) : int
transaction System.Data.SqlClient.SqlTransaction The current transaction.
리턴 int

SqlScriptRunner() 공개 메소드

Initializes a new instance of the SqlScriptRunner class.
public SqlScriptRunner ( Assembly assemblyWithEmbeddedScript, Type scopingType, string scriptName, Encoding encoding ) : System
assemblyWithEmbeddedScript System.Reflection.Assembly The assembly containing the script as an embedded resource.
scopingType System.Type /// Used to scope the script name within the embedded resource. ///
scriptName string Name of the script.
encoding System.Text.Encoding The encoding.
리턴 System

SqlScriptRunner() 공개 메소드

Initializes a new instance of the SqlScriptRunner class. Initializes the script to execute.
public SqlScriptRunner ( Assembly assemblyWithEmbeddedScript, string fullScriptName, Encoding encoding ) : System
assemblyWithEmbeddedScript System.Reflection.Assembly The assembly with the script as an embedded resource.
fullScriptName string Fully qualified resource name of the script.
encoding System.Text.Encoding The encoding.
리턴 System

SqlScriptRunner() 공개 메소드

Initializes a new instance of the SqlScriptRunner class.
public SqlScriptRunner ( ScriptCollection scripts ) : System
scripts ScriptCollection The scripts.
리턴 System

SqlScriptRunner() 공개 메소드

Initializes a new instance of the SqlScriptRunner class.
public SqlScriptRunner ( Stream scriptStream, Encoding encoding ) : System
scriptStream Stream The stream containing the script to execute.
encoding System.Text.Encoding The encoding.
리턴 System

SqlScriptRunner() 공개 메소드

Initializes a new instance of the SqlScriptRunner class. Initializes the script to execute.
public SqlScriptRunner ( Type scopingType, string scriptName, Encoding encoding ) : System
scopingType System.Type /// A type whose assembly contains the script as an embedded resource. /// Also used to scope the script name. See remarks. ///
scriptName string Name of the script.
encoding System.Text.Encoding The encoding.
리턴 System

SqlScriptRunner() 공개 메소드

Initializes a new instance of the SqlScriptRunner class.
public SqlScriptRunner ( string scriptText ) : System
scriptText string The full script text to execute.
리턴 System