public static async Task OrderAsync() { Customer greatCustomer = null; Article article = null; Article article2 = null; greatCustomer = await GetOrCreateGreatCustomerAsync().ConfigureAwait(false); article = await GetOrCreateAggregateAsync <ArticleViewModel, Article>(readRepository, x => x.Articlenumber == "A12345", () => new Article(ArticleId.Generate(), "A12345", "A great article", Money.EUR(99.99m))) .ConfigureAwait(false); article2 = await GetOrCreateAggregateAsync <ArticleViewModel, Article>(readRepository, x => x.Articlenumber == "B12345", () => new Article(ArticleId.Generate(), "B12345", "Another great article", Money.EUR(59.99m))) .ConfigureAwait(false); var shoppingCart = new ShoppingCart(ShoppingCartId.Generate(), greatCustomer.Id, greatCustomer.StateModel.Name); var shoppingCartArticle1 = await shoppingCart.PlaceArticleAsync(ShoppingCartArticleId.Generate(shoppingCart.Id), article.Id, 1, repository); await shoppingCart.PlaceArticleAsync(ShoppingCartArticleId.Generate(shoppingCart.Id), article2.Id, 1, repository); shoppingCartArticle1.RemoveFromShoppingCart(); shoppingCart.Order(repository); await repository.SaveAsync(shoppingCart); var projection = CustomerState.LoadState(greatCustomer.StateModel); }