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); }
public Account(Guid clientId, IAccountNumberGenerator accountNumberGenerator) { var @event = new NewAccountCreated { AccountId = Guid.NewGuid(), ClientId = clientId, Number = accountNumberGenerator.Generate() }; Apply(@event); Append(@event); }
/// <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(); }
public void AddAccount(IAccountNumberGenerator accountNumberGenerator) { ApplyChange(new NewAccountCreatedEvent(AggregateId, accountNumberGenerator.Generate(), ClientId)); }