executeTransactionOperation<R> method
FutureOr<R>
executeTransactionOperation<R>(
- TransactionOperation op,
- FutureOr<
R> f(- DBObjectDirectoryAdapterContext connection
Implementation
FutureOr<R> executeTransactionOperation<R>(TransactionOperation op,
FutureOr<R> Function(DBObjectDirectoryAdapterContext connection) f) {
var transaction = op.transaction;
if (isTransactionWithSingleOperation(op)) {
return executeWithPool(f,
onError: (e, s) => transaction.notifyExecutionError(
e,
s,
errorResolver: resolveError,
operation: op,
debugInfo: () => op.toString(),
));
}
if (transaction.isOpen) {
return transaction.addExecution<R, DBObjectDirectoryAdapterContext>(
(c) => f(c),
errorResolver: resolveError,
operation: op,
debugInfo: () => op.toString(),
);
}
if (!transaction.isOpening) {
transaction.open(
() => openTransaction(transaction),
callCloseTransactionRequired
? () => closeTransaction(transaction,
transaction.context as DBObjectDirectoryAdapterContext?)
: null,
);
}
return transaction.onOpen<R>(() {
return transaction.addExecution<R, DBObjectDirectoryAdapterContext>(
(c) => f(c),
errorResolver: resolveError,
operation: op,
debugInfo: () => op.toString(),
);
});
}