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, Boolean)
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 |
System.Boolean | manualRefresh | When set to true, you will need to make your own calls to RefreshTable. |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Commit(Boolean)
Commit changes made inside this transaction.
Declaration
public TransactionFailure Commit(bool processMembers = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | 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); } |
Dispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Overrides
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 |
---|---|
System.Boolean | false if we couldn't get all locks, otherwise true is returned |