Class Transaction
Implements
Inherited Members
Namespace: DesignData.SDS2.Database
Assembly: DesignData.SDS2.Database.dll
Syntax
public class Transaction : ReadOnlyTransaction, IDisposable
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Constructors
Transaction(Job, ILockHandler, bool)
Declaration
public Transaction(Job activeJob, ILockHandler lockHandler, bool manualRefresh = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Job | activeJob | If it is not already opened, this job will be opened and made the active job. |
| ILockHandler | lockHandler | See documentation for this interface, callbacks will be called on this as we go through the locking process |
| bool | manualRefresh | When set to true, you will need to make your own calls to RefreshTable. |
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Methods
Add(BoltHandle)
Add a bolt to the transaction so that it can be modified. You will need to Lock() again after adding bolts.
Declaration
public void Add(BoltHandle bolt)
Parameters
| Type | Name | Description |
|---|---|---|
| BoltHandle | bolt |
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Add(ComponentHandle)
Add a component to the transaction so that it can be modified. You will need to Lock() again after adding components.
Declaration
public void Add(ComponentHandle component)
Parameters
| Type | Name | Description |
|---|---|---|
| ComponentHandle | component |
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Add(CustomPropertyMapHandle)
Add a custom property map to the transaction so that it can be modified. You will need to Lock() again after adding maps.
Declaration
public void Add(CustomPropertyMapHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| CustomPropertyMapHandle | handle |
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Add(DrawingHandle)
Add a drawing to the transaction so that it can be modified. You will need to Lock() again after adding drawings.
Declaration
public void Add(DrawingHandle drawing)
Parameters
| Type | Name | Description |
|---|---|---|
| DrawingHandle | drawing |
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Add(FabricatorHandle)
Add fabricator to the transaction so that it can be modified. You will need to Lock() again after adding fabricator.
Declaration
public void Add(FabricatorHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| FabricatorHandle | handle |
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Add(GridLineHandle)
Add a grid line to the transaction before locking so that it can be modified.
Declaration
public void Add(GridLineHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| GridLineHandle | handle |
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Add(GroupMemberHandle)
Add a group member to the transaction before locking so that it can be modified.
Declaration
public void Add(GroupMemberHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| GroupMemberHandle | handle |
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Add(HoleHandle)
Add a hole to the transaction so that it can be modified. You will need to Lock() again after adding holes.
Declaration
public void Add(HoleHandle hole)
Parameters
| Type | Name | Description |
|---|---|---|
| HoleHandle | hole |
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Add(JobSetupHandle)
Add job setup to the transaction so that it can be modified. You will need to Lock() again after adding job setup.
Declaration
public void Add(JobSetupHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| JobSetupHandle | handle |
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Add(MaterialFileHandle)
Add a material file to the transaction so that it can be modified. You will need to Lock() again after adding a material file.
Declaration
public void Add(MaterialFileHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialFileHandle | handle |
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Add(MaterialHandle)
Add a material to the transaction so that it can be modified. You will need to Lock() again after adding materials.
Declaration
public void Add(MaterialHandle material)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialHandle | material |
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Add(MemberHandle)
Add a member to the transaction before locking so that it can be modified.
Declaration
public void Add(MemberHandle memberHandle)
Parameters
| Type | Name | Description |
|---|---|---|
| MemberHandle | memberHandle |
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Add(NoteHandle)
Add a note to the transaction before locking so that it can be modified.
Declaration
public void Add(NoteHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| NoteHandle | handle |
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Add(UserDefinedConnectionHandle)
Add a new user defined connection to the list of user defined connections on commit. Once you've done this, and then Committed, then you can use this connection on the end of a member.
Declaration
public void Add(UserDefinedConnectionHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| UserDefinedConnectionHandle | handle |
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Add(WeldHandle)
Add a weld to the transaction so that it can be modified. You will need to Lock() again after adding welds.
Declaration
public void Add(WeldHandle weld)
Parameters
| Type | Name | Description |
|---|---|---|
| WeldHandle | weld |
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Commit(bool)
Commit changes made inside this transaction.
Declaration
public TransactionFailure Commit(bool processMembers = false)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | processMembers |
Returns
| Type | Description |
|---|---|
| TransactionFailure | A TransactionFailure object, which is implicitly castable to a boolean to indicate if the commit succeeded (true). Or to a string for the user presentable reason it failed (or the empty string if it passed). Or to a TransactionFailureCode to indicate why it failed. So you can write:
if(transaction.Commit())
{
//only happens if the commit passes!
}
Or:
var failure = transaction.Commit();
if(failure.TransactionFailed)
{
//only happens if the commit fails!
Console.WriteLine(failure.Reason);
}
|
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Dispose(bool)
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
Overrides
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.
Lock()
Lock everything which has been added to this transaction. Once it's been locked you can safely use Get and GetBrief and then modify data before committing.
Declaration
public bool Lock()
Returns
| Type | Description |
|---|---|
| bool | false if we couldn't get all locks, otherwise true is returned |
Remarks
A Transaction must be used in a using statement so that it will be properly disposed at the end of that block of code. Otherwise, the locks held by the Transaction may be held until the Transaction is garbage-collected.
Transaction objects may be reused after a commit. Handles that have been added to a Transaction are kept through the commit. Handles cannot be removed from a Transaction.