Transaction class constructors are described in the following table:
Constructor |
Description/Notes |
---|---|
protected Transaction(ServiceBase srvc); |
Accepts service as an argument. |
protected Transaction(ServiceBase srvc, TimeSpan timeout) |
Accepts service as an argument, and limits the transaction time to the provided timeout. |
If the timeout is too short, and it fires before the Result can set it and get to fetch a return value, it is possible to get the following exception: InvalidOperationException: An attempt was made to transition a task to a final state when it had already completed.
Transaction class properties are described in the following table:
Property |
Description/Notes |
---|---|
public ServiceBase Service; |
Property to get service. |
public T Result; |
Call to this property wait until a result is returned by the SetResult or SetException methods. This property throws a System.AggregateException exception set by the SetException method. |
Transaction class methods are described in the following table:
For an example of creating and implementing a transaction class, refer to Writing Transactions. |