public Task <ICompletableSynchronizedStorageSession> TryAdapt(IOutboxTransaction transaction, ContextBag context, CancellationToken cancellationToken = default) { if (transaction is NonDurableOutboxTransaction inMemOutboxTransaction) { ICompletableSynchronizedStorageSession session = new NonDurableSynchronizedStorageSession(inMemOutboxTransaction.Transaction); return(Task.FromResult(session)); } return(EmptyTask); }
public Task <ICompletableSynchronizedStorageSession> TryAdapt(TransportTransaction transportTransaction, ContextBag context, CancellationToken cancellationToken = default) { if (transportTransaction.TryGet(out Transaction ambientTransaction)) { var transaction = new NonDurableTransaction(); ICompletableSynchronizedStorageSession session = new NonDurableSynchronizedStorageSession(transaction); ambientTransaction.EnlistVolatile(new EnlistmentNotification2(transaction), EnlistmentOptions.None); return(Task.FromResult(session)); } return(EmptyTask); }