示例#1
0
 protected async Task SaveSagaWithSession <TSagaData>(TSagaData saga, CompletableSynchronizedStorageSession session, ContextBag context, CancellationToken cancellationToken = default)
     where TSagaData : class, IContainSagaData, new()
 {
     SetupNewSaga(saga);
     var correlationProperty = GetSagaCorrelationProperty(saga);
     await configuration.SagaStorage.Save(saga, correlationProperty, session, context, cancellationToken);
 }
        /// <summary>
        /// Creates a <see cref="IInvokeHandlerContext" /> based on the current context.
        /// </summary>
        public static IInvokeHandlerContext CreateInvokeHandlerContext(this StageConnector <IIncomingLogicalMessageContext, IInvokeHandlerContext> stageConnector, MessageHandler messageHandler, CompletableSynchronizedStorageSession storageSession, IIncomingLogicalMessageContext sourceContext)
        {
            Guard.AgainstNull(nameof(messageHandler), messageHandler);
            Guard.AgainstNull(nameof(storageSession), storageSession);
            Guard.AgainstNull(nameof(sourceContext), sourceContext);

            return(new InvokeHandlerContext(messageHandler, storageSession, sourceContext));
        }
        /// <summary>
        /// Creates a <see cref="IInvokeHandlerContext" /> based on the current context.
        /// </summary>
        public static IInvokeHandlerContext CreateInvokeHandlerContext(this StageConnector<IIncomingLogicalMessageContext, IInvokeHandlerContext> stageConnector, MessageHandler messageHandler, CompletableSynchronizedStorageSession storageSession, IIncomingLogicalMessageContext sourceContext)
        {
            Guard.AgainstNull(nameof(messageHandler), messageHandler);
            Guard.AgainstNull(nameof(storageSession), storageSession);
            Guard.AgainstNull(nameof(sourceContext), sourceContext);

            return new InvokeHandlerContext(messageHandler, storageSession, sourceContext);
        }