Distributed Transactions in NDO

In the Enterprise edition, NDO supplies three classes that can serve as transaction roots for the .NET Enterprise Services. The functionality of these classes is identical but they have different parameters for the Transaction attribute:

RequiredTransactionRoot (TransactionOption.Required)

RequiresNewTransactionRoot (TransactionOption.RequiresNewTransaction)

SupportedTransactionRoot (TransactionOption.Supported)

You can find the description of the Transaction attribute and the TransactionOption enumeration in the MSDN documentation.

The transaction roots are used as follows:

try

{

    RequiredTransactionRoot txRoot = new RequiredTransactionRoot();

    PersistenceManager pm = txRoot.PersistenceManager;

    // ... Your operations

    txRoot.Save();

}

catch (Exception ex)

{

    txRoot.Abort();

    // Error handling

}

You are free to write your own Serviced Components and use them in combination with the TransactionRoot objects. In that case the attributes Required respectively Supported are recommended.