C# 클래스 Tiraggo.Interfaces.tgTransactionScope

This is the EntitySpaces ADO.NET connection based transaction class that mimics the System.Transactions.TransactionScope class.
EntitySpaces supports two transactions models, connection based via this class (tgTransactionScope) and the new System.Transactions.TransactionScope. Some databases such as Microsoft Access don't support the new System.Transactions.TransactionScope class. And still there are other cases where the System.Transactions.TransactionScope class cannot be used as is the case with a lot of hosting companies. Thus EntitySpaces provides a very nice ADO.NET connection based transaction handler. The Syntax should be as follows: using (tgTransactionScope scope = new tgTransactionScope()) { // Logic here ... scope.Complete(); // last line of using statement } Note that if an exception is thrown scope.Complete will not be called, and the transaction upon leaving the using statement will be rolled back. You indicate whether you want the provider to use the tgTransactionScope or the System.Transactions.TransactionScope class in your .config file. Notice in the config file setting below that providerClass="DataProvider". This indicates that you want to use the tgTransactionScope class, use providerClass="DataProviderEnterprise" to use System.Transactions.TransactionScope. <add name="SQL" providerMetadataKey="esDefault" sqlAccessType="DynamicSQL" provider="Tiraggo.SqlClientProvider" providerClass="DataProvider" connectionString="User ID=sa;Password=griffinski;Initial Catalog=Northwind;Data Source=localhost" databaseVersion="2005"/>
상속: IDisposable
파일 보기 프로젝트 열기: BrewDawg/Tiraggo 1 사용 예제들

공개 메소드들

메소드 설명
AddForCommit ( ICommittable commit ) : bool

You should never call this directly, EntitySpaces calls this internally.

Complete ( ) : void

You must call Complete to commit the transaction. Calls and transactions can be nested, only the final outer call to Complete will commit the transaction.

DeEnlist ( IDbCommand cmd ) : void

You should never call this directly, the providers call this method.

Enlist ( IDbCommand cmd, string connectionString, CreateIDbConnectionDelegate creator ) : void

You should never call this directly, the providers call this method.

GetCurrentTransactionScopeOption ( ) : tgTransactionScopeOption

This can be used to get the tgTransactionScopeOption from the current tgTransactionScope (remember transactions can be nested). If there is no on-going transaction then tgTransactionScopeOption.None is returned.

tgTransactionScope ( ) : System

The default constructor, this transactions tgTransactionScopeOption will be set to Required. The IsolationLevel is set to Unspecified. using (tgTransactionScope scope = new tgTransactionScope()) { // Do your work here scope.Complete(); }

tgTransactionScope ( tgTransactionScopeOption option ) : System

Use this constructor to control the tgTransactionScopeOption as it applies to this transaction. using (tgTransactionScope scope = new tgTransactionScope(tgTransactionScopeOption.RequiresNew)) { // Do your work here scope.Complete(); }

tgTransactionScope ( tgTransactionScopeOption option, IsolationLevel level ) : System

Use this constructor to control the tgTransactionScopeOption as it applies to this transaction. using (tgTransactionScope scope = new tgTransactionScope(tgTransactionScopeOption.RequiresNew, IsolationLevel.ReadCommitted)) { // Do your work here scope.Complete(); }

보호된 메소드들

메소드 설명
CommonInit ( tgTransactionScope tx ) : void

This is the common constructor logic, tx is "this" from the constructor

비공개 메소드들

메소드 설명
GetCurrentTx ( ) : tgTransactionScope

Internal method.

IDisposable ( ) : void

Internal. Called when the "using" statement is exited.

Rollback ( ) : void

Internal method, called if the "using" statement is left without calling scope.Complete()

메소드 상세

AddForCommit() 공개 정적인 메소드

You should never call this directly, EntitySpaces calls this internally.
public static AddForCommit ( ICommittable commit ) : bool
commit ICommittable Any class that implements ICommittable
리턴 bool

CommonInit() 보호된 정적인 메소드

This is the common constructor logic, tx is "this" from the constructor
protected static CommonInit ( tgTransactionScope tx ) : void
tx tgTransactionScope
리턴 void

Complete() 공개 메소드

You must call Complete to commit the transaction. Calls and transactions can be nested, only the final outer call to Complete will commit the transaction.
public Complete ( ) : void
리턴 void

DeEnlist() 공개 정적인 메소드

You should never call this directly, the providers call this method.
public static DeEnlist ( IDbCommand cmd ) : void
cmd IDbCommand The command to enlist into a transaction
리턴 void

Enlist() 공개 정적인 메소드

You should never call this directly, the providers call this method.
public static Enlist ( IDbCommand cmd, string connectionString, CreateIDbConnectionDelegate creator ) : void
cmd IDbCommand The command to enlist into a transaction
connectionString string The connection string passed to the CreateIDbConnectionDelegate delegate
creator CreateIDbConnectionDelegate The delegate previously registered by the provider
리턴 void

GetCurrentTransactionScopeOption() 공개 정적인 메소드

This can be used to get the tgTransactionScopeOption from the current tgTransactionScope (remember transactions can be nested). If there is no on-going transaction then tgTransactionScopeOption.None is returned.
public static GetCurrentTransactionScopeOption ( ) : tgTransactionScopeOption
리턴 tgTransactionScopeOption

tgTransactionScope() 공개 메소드

The default constructor, this transactions tgTransactionScopeOption will be set to Required. The IsolationLevel is set to Unspecified. using (tgTransactionScope scope = new tgTransactionScope()) { // Do your work here scope.Complete(); }
public tgTransactionScope ( ) : System
리턴 System

tgTransactionScope() 공개 메소드

Use this constructor to control the tgTransactionScopeOption as it applies to this transaction. using (tgTransactionScope scope = new tgTransactionScope(tgTransactionScopeOption.RequiresNew)) { // Do your work here scope.Complete(); }
public tgTransactionScope ( tgTransactionScopeOption option ) : System
option tgTransactionScopeOption See
리턴 System

tgTransactionScope() 공개 메소드

Use this constructor to control the tgTransactionScopeOption as it applies to this transaction. using (tgTransactionScope scope = new tgTransactionScope(tgTransactionScopeOption.RequiresNew, IsolationLevel.ReadCommitted)) { // Do your work here scope.Complete(); }
public tgTransactionScope ( tgTransactionScopeOption option, IsolationLevel level ) : System
option tgTransactionScopeOption See
level IsolationLevel See IsolationLevel in the System.Data namespace
리턴 System