コード例 #1
0
        private static void CreateAccount(Guid correlationId)
        {
            var accountCreation = new AccountDetailsProvided(correlationId)
            {
                Username             = "******",
                Password             = "******",
                PasswordConfirmation = "james is awesome",
            };

            var excutionResult = _sagaMediator.Consume(accountCreation);

            if (!excutionResult.IsSuccessful)
            {
                Console.WriteLine(excutionResult.ToString());
            }
        }
コード例 #2
0
ファイル: AccountCreationSaga.cs プロジェクト: itomych/NSaga
        public OperationResult Consume(AccountDetailsProvided message)
        {
            if (!SagaData.IsVerificationCodeMatched)
            {
                throw new Exception("Verification Code has not been matched. How did you get here?");
            }

            if (message.Password != message.PasswordConfirmation)
            {
                return(new OperationResult("Password confirmation does not match the password"));
            }

            //TODO create user, saga has finished.

            return(new OperationResult());
        }