public CashoutRegistrationAggregate ToDomain() { return(CashoutRegistrationAggregate.Restore( ETag, StartMoment, OperationId, AssetId, FinishMoment)); }
public static CashoutRegistrationEntity FromDomain(CashoutRegistrationAggregate aggregate) { return(new CashoutRegistrationEntity { ETag = string.IsNullOrEmpty(aggregate.Version) ? "*" : aggregate.Version, PartitionKey = GetPartitionKey(aggregate.OperationId), RowKey = GetRowKey(aggregate.OperationId), StartMoment = aggregate.StartMoment, OperationId = aggregate.OperationId, AssetId = aggregate.AssetId, FinishMoment = aggregate.FinishMoment }); }
private async Task OnStarted(Guid operationId, string assetId, DateTime startMoment, ICommandSender sender) { var aggregate = await _repository.GetOrAddAsync( operationId, () => CashoutRegistrationAggregate.StartNew(operationId, assetId)); aggregate.OnStarted(DateTime.UtcNow); sender.SendCommand(new RegisterCashoutRegistrationLastMomentCommand { AssetId = aggregate.AssetId, Moment = startMoment, OperationId = aggregate.OperationId }, CashoutRegistrationBoundedContext.Name); _chaosKitty.Meow(operationId); await _repository.SaveAsync(aggregate); }
public Task SaveAsync(CashoutRegistrationAggregate aggregate) { return(_aggregateRepository.SaveAsync(aggregate)); }