Inherits from: NSObject
Declared in: EOAccess/EOAdaptorContext.h
EOAdaptorContext is an abstract class that provides its concrete subclasses with a structure for handling database transactions. It's associated with EOAdaptor and EOAdaptorChannel, which, together with EOAdaptorContext, form the adaptor level of Enterprise Objects Framework's access layer. See the EOAdaptor class specification for more information about accessing, creating, and using adaptor level objects.
A concrete subclass of EOAdaptorContext provides database-specific method implementations and represents a single transaction scope (logical user) on the database server to which its EOAdaptor object is connected. You never interact with instances of the EOAdaptorContext class, rather your Enterprise Objects Framework applications use instances of concrete subclasses that are written to work with a specific database or other persistent storage system.
If a database server supports multiple concurrent transaction sessions, an adaptor context's EOAdaptor can have several contexts. When you use multiple EOAdaptorContexts for a single EOAdaptor, you can have several database server transactions in progress simultaneously. You should be aware of the issues involved in concurrent access if you do this.
EOAdaptorContext isn't declared to be abstract, but conceptually it is abstract. Never create instances of the EOAdaptorContext class. |
Method | Description |
- beginTransaction | Begins a transaction in the database server. |
- commitTransaction | Commits the last transaction begun. |
- rollbackTransaction | Rolls back the last transaction begun. |
- setDebugEnabled: | Enables debugging in all the adaptor context's channels. |
- Creating an EOAdaptorContext
- - initWithAdaptor:
- Accessing the adaptor
- - adaptor
- Creating adaptor channels
- - createAdaptorChannel
- - channels
- Accessing and managing connection status
- - hasOpenChannels
- - hasBusyChannels
- - handleDroppedConnection
- Controlling transactions
- - beginTransaction
- - commitTransaction
- - rollbackTransaction
- - transactionDidBegin
- - transactionDidCommit
- - transactionDidRollback
- - hasOpenTransaction
- Accessing the delegate
- - delegate
- - setDelegate:
- + defaultDelegate
- + setDefaultDelegate:
+ (BOOL)debugEnabledDefault
+ (id)defaultDelegate
+ (void)setDebugEnabledDefault:(BOOL)flag
See Also: - isDebugEnabled
+ (void)setDefaultDelegate:(id)defaultDelegate
- (EOAdaptor *)adaptor
See Also: - initWithAdaptor:
- (void)beginTransaction
The Enterprise Objects Framework automatically wraps database operations in transactions, so you don't have to begin and end transactions explicitly. In fact, letting the framework manage transactions is sometimes more efficient. You typically use beginTransaction only to execute more than one database operation in the same transaction scope.
This method invokes the delegate method adaptorContextShouldBegin: before beginning the transaction. If the transaction is begun successfully, the method sends self a transactionDidBegin message and invokes the delegate method adaptorContextDidBegin:. Raises an exception if the attempt is unsuccessful. Some possible reasons for failure are:
An adaptor context subclass should override this method without invoking EOAdaptorContext's implementation.
See Also: - hasOpenTransaction
- (NSArray *)channels
See Also: - createAdaptorChannel
- (void)commitTransaction
An adaptor context subclass should override this method without invoking EOAdaptorContext's implementation.
See Also: - beginTransaction, - rollbackTransaction, - hasBusyChannels
- (EOAdaptorChannel *)createAdaptorChannel
See Also: - channels
- delegate
- (void)handleDroppedConnection
You should never invoke this method; it is invoked automatically by the Framework. Subclasses must implement this method, without invoking super, if the adaptor supports automatic database reconnection.
- (BOOL)hasBusyChannels
See Also: - isFetchInProgress (EOAdaptorChannel)
- (BOOL)hasOpenChannels
See Also: - openChannel (EOAdaptorChannel), - isOpen (EOAdaptorChannel)
- (BOOL)hasOpenTransaction
YES
if
a transaction is open (begun but not yet committed or rolled back), NO
otherwise.- initWithAdaptor:(EOAdaptor
*)adaptor
You never invoke this method directly. You must use the EOAdaptor method createAdaptorContext to create a new adaptor context.
See Also: - adaptor
- (BOOL)isDebugEnabled
See Also: + debugEnabledDefault, + setDebugEnabledDefault:
- (void)rollbackTransaction
An adaptor context subclass should override this method without invoking EOAdaptorContext's implementation.
See Also: - beginTransaction, - commitTransaction
- (void)setDebugEnabled:(BOOL)flag
See Also: - setDebugEnabled: (EOAdaptorChannel), - isDebugEnabled, + setDebugEnabledDefault:, - channels
- (void)setDelegate:delegate
See Also: - channels
- (void)transactionDidBegin
You don't need to invoke this method unless you are implementing a concrete adaptor. Your concrete adaptor should invoke this method from within your adaptor context's implementation of beginTransaction method and anywhere else it begins a transaction-either implicitly or explicitly. For example, an adaptor channel's implementation of evaluateExpression: should check to see if a transaction is in progress. If no transaction is in progress, it can start one explicitly by invoking beginTransaction. Alternatively, it can start an implicit transaction by invoking transactionDidBegin.
A subclass of EOAdaptorContext doesn't need to override this method. A subclass that does override it must incorporate the superclass's version through a message to super.
- (void)transactionDidCommit
You don't need to invoke this method unless you are implementing a concrete adaptor. Your concrete adaptor should invoke this method from within your adaptor context's implementation of commitTransaction method and anywhere else it commits a transaction-either implicitly or explicitly.
A subclass of EOAdaptorContext doesn't need to override this method. A subclass that does override it must incorporate the superclass's version through a message to super.
- (void)transactionDidRollback
You don't need to invoke this method unless you are implementing a concrete adaptor. Your concrete adaptor should invoke this method from within your adaptor context's implementation of rollbackTransaction method and anywhere else it rolls back a transaction-either implicitly or explicitly.
A subclass of EOAdaptorContext doesn't need to override this method. A subclass that does override it must incorporate the superclass's version through a message to super.
Notification Object | The notifying EOAdaptorContext object |
Userinfo | None |
Notification Object | The notifying EOAdaptorContext object |
Userinfo | None |
Notification Object | The notifying EOAdaptorContext object |
Userinfo | None |