コード例 #1
0
        public async ValueTask Handle(DefineAccount command, CancellationToken cancellationToken = default)
        {
            var optionalChart = await _chartOfAccounts.GetOptional(cancellationToken);

            var chart = optionalChart.HasValue ? optionalChart.Value : ChartOfAccounts.Factory();

            chart.DefineAccount(new AccountName(command.AccountName !), new AccountNumber(command.AccountNumber));

            if (!optionalChart.HasValue)
            {
                _chartOfAccounts.Add(chart);
            }
        }