ImageGear for .NET User Guide > Using ImageGear for .NET > Using ImageGear.Web.DataProviders Namespace > Implementing Annotations in an Image Data Provider > Enabling Annotation within a Custom Image Data Provider > Background Information on Transactions |
Transactional programming requires working with resources such as databases that are capable of participating in a transaction, and being able to commit or roll back the changes made during the transaction. Typically, you inform a resource that you want to perform transactional work against it. This is called enlisting the resource in the transaction. You then perform work against the resource, and if no error occurs, you ask the resource to commit the changes made to its state. If you encounter any error, you ask it to roll back the changes. During a transaction, it is vital that you do not access any non-transactional resources, because changes made to those resources will not roll back if the transaction is aborted. The .NET Framework 2.0 automates the act of enlisting and managing a transaction against transactional resources. The System.Transactions Namespace offers a common infrastructure for transaction classes, common behaviors, and helper classes. For more information on transactions, refer to the MSDN library documentation under .NET Framework Programming in Visual Studio -> Accessing Data -> Transaction Processing:
http://msdn.microsoft.com/en-us/library/w97s6fw4.aspx
The .NET Framework defines a resource manager as a resource that can automatically enlist in a transaction managed by System.Transactions. The resource has to detect that it is being accessed by a transaction and enlist in that transaction. The System.Transactions Namespace supports a concept called an ambient transaction. When the provider is asked to save annotations data, your provider code will be executing in this ambient transaction within the ImageGear21.Web.Services API method's scope of TransactionScope.