예제 #1
0
 public Account(IAccountNumberGenerator generator, PersonalInfo ownersPersonalInfo, decimal balance, bool isClosed, int benefitPoints)
 {
     NumberOfAccount    = generator.Generate();
     OwnersPersonalInfo = ownersPersonalInfo ?? throw new ArgumentNullException(nameof(ownersPersonalInfo));
     Balance            = balance;
     this.isClosed      = isClosed;
     this.benefitPoints = benefitPoints;
 }
        public Account(Guid clientId, IAccountNumberGenerator accountNumberGenerator)
        {
            var @event = new NewAccountCreated(
                Guid.NewGuid(),
                clientId,
                accountNumberGenerator.Generate()
                );

            Apply(@event);
            Enqueue(@event);
        }
예제 #3
0
        public Account(Guid clientId, IAccountNumberGenerator accountNumberGenerator)
        {
            var @event = new NewAccountCreated
            {
                AccountId = Guid.NewGuid(),
                ClientId  = clientId,
                Number    = accountNumberGenerator.Generate()
            };

            Apply(@event);
            Append(@event);
        }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BankAccount"/> class.
 /// </summary>
 /// <param name="AccHolder">The account holder.</param>
 /// <param name="idGenerator">The identifier generator.</param>
 protected BankAccount(AccountHolder AccHolder, IAccountNumberGenerator idGenerator)
 {
     Holder   = AccHolder;
     idNumber = idGenerator.Generate();
 }
예제 #5
0
파일: Client.cs 프로젝트: psroczyk/CQRS-ES
 public void AddAccount(IAccountNumberGenerator accountNumberGenerator)
 {
     ApplyChange(new NewAccountCreatedEvent(AggregateId, accountNumberGenerator.Generate(), ClientId));
 }