# AsynchronousDataTransaction

    public final class AsynchronousDataTransaction : BaseDataTransaction

    extension AsynchronousDataTransaction: CustomDebugStringConvertible, CoreStoreDebugStringConvertible

The `AsynchronousDataTransaction` provides an interface for `DynamicObject` creates, updates, and deletes. A transaction object should typically be only used from within a transaction block initiated from `DataStack.perform(asynchronous:...)`.

- `cancel()`

  Cancels a transaction by throwing `CoreStoreError.userCancelled`.

      try transaction.cancel()

  Important

  Never use `try?` or `try!` on a `cancel()` call. Always use `try`. Using `try?` will swallow the cancellation and the transaction will proceed to commit as normal. Using `try!` will crash the app as `cancel()` will always throw an error.

  #### Declaration

  Swift

      public func cancel() throws -> Never

### Result

- `Result`

  The `Result` contains the success or failure information for a completed transaction. `Result<T>.success` indicates that the transaction succeeded, either because the save succeeded or because there were no changes to save. The associated `userInfo` is the value returned from the transaction closure. `Result<T>.failure` indicates that the transaction either failed or was cancelled. The associated object for this value is a `CoreStoreError` enum value.

  #### Declaration

  Swift

      public typealias Result<UserInfoType> = Swift.Result<UserInfoType, CoreStoreError>

### BaseDataTransaction

- `create(_:)`

  Creates a new `NSManagedObject` or `CoreStoreObject` with the specified entity type.

  #### Declaration

  Swift

      public override func create<O>(_ into: Into<O>) -> O where O : DynamicObject

  #### Parameters

  `into` | the `Into` clause indicating the destination `NSManagedObject` or `CoreStoreObject` entity type and the destination configuration

  #### Return Value

  a new `NSManagedObject` or `CoreStoreObject` instance of the specified entity type.

- `edit(_:)`

  Returns an editable proxy of a specified `NSManagedObject` or `CoreStoreObject`.

  #### Declaration

  Swift

      public override func edit<O>(_ object: O?) -> O? where O : DynamicObject

  #### Parameters

  `object` | the `NSManagedObject` or `CoreStoreObject` to be edited

  #### Return Value

  an editable proxy for the specified `NSManagedObject` or `CoreStoreObject`.

- `edit(_:_:)`

  Returns an editable proxy of the object with the specified `NSManagedObjectID`.

  #### Declaration

  Swift

      public override func edit<O>(_ into: Into<O>, _ objectID: NSManagedObjectID) -> O? where O : DynamicObject

  #### Parameters

  `into` | an `Into` clause specifying the entity type
  `objectID` | the `NSManagedObjectID` for the object to be edited

  #### Return Value

  an editable proxy for the specified `NSManagedObject` or `CoreStoreObject`.

- `delete(objectIDs:)`

  Deletes the objects with the specified `NSManagedObjectID`s.

  #### Declaration

  Swift

      public override func delete<S>(objectIDs: S) where S : Sequence, S.Element : NSManagedObjectID

  #### Parameters

  `objectIDs` | the `NSManagedObjectID`s of the objects to delete

- `delete(_:_:)`

  Deletes the specified `NSManagedObject`s or `CoreStoreObject`s represented by series of `ObjectRepresentation`s.

  #### Declaration

  Swift

      public override func delete<O>(_ object: O?, _ objects: O?...) where O : ObjectRepresentation

  #### Parameters

  `object` | the `ObjectRepresentation` representing an `NSManagedObject` or `CoreStoreObject` to be deleted
  `objects` | other `ObjectRepresentation`s representing `NSManagedObject`s or `CoreStoreObject`s to be deleted

- `delete(_:)`

  Deletes the specified `NSManagedObject`s or `CoreStoreObject`s represented by an `ObjectRepresenation`.

  #### Declaration

  Swift

      public override func delete<S>(_ objects: S) where S : Sequence, S.Element : ObjectRepresentation

  #### Parameters

  `objects` | the `ObjectRepresenation`s representing `NSManagedObject`s or `CoreStoreObject`s to be deleted

### CustomDebugStringConvertible

- `debugDescription`

  #### Declaration

  Swift

      public var debugDescription: String { get }